misago.js 576 B

123456789101112131415161718192021222324
  1. import Ember from 'ember';
  2. import DocumentTitle from 'misago/mixins/document-title';
  3. import ResetScroll from 'misago/mixins/reset-scroll';
  4. import ModelUrlName from 'misago/mixins/model-url-name';
  5. export default Ember.Route.extend(DocumentTitle, ResetScroll, ModelUrlName, {
  6. // Shorthands for raising errors
  7. throw403: function(reason) {
  8. if (reason) {
  9. throw {
  10. status: 403,
  11. responseJSON: {
  12. detail: reason
  13. }
  14. };
  15. } else {
  16. throw { status: 403 };
  17. }
  18. },
  19. throw404: function() {
  20. throw { status: 404 };
  21. }
  22. });