mirror of
https://github.com/discourse/discourse.git
synced 2025-04-17 09:51:30 +08:00
UX: Use the same 404 page for the unknown
route and exception handler
This commit is contained in:
parent
e8d5d34755
commit
cf3ea4f9bd
@ -32,6 +32,7 @@ export default Ember.Controller.extend({
|
||||
if (this.get('thrown.jqTextStatus') === "timeout") return true;
|
||||
return false;
|
||||
}.property(),
|
||||
|
||||
isNotFound: Em.computed.equal('thrown.status', 404),
|
||||
isForbidden: Em.computed.equal('thrown.status', 403),
|
||||
isServer: Em.computed.gte('thrown.status', 500),
|
||||
|
@ -1,6 +1,7 @@
|
||||
export default function() {
|
||||
// Error page
|
||||
this.route('exception', { path: '/exception' });
|
||||
this.route('exception-unknown', { path: '/404' });
|
||||
|
||||
this.route('about', { path: '/about', resetNamespace: true });
|
||||
|
||||
|
@ -83,6 +83,10 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
||||
c.error(xhrOrErr);
|
||||
}
|
||||
|
||||
if (xhrOrErr && xhrOrErr.status === 404) {
|
||||
return this.transitionTo('exception-unknown');
|
||||
}
|
||||
|
||||
exceptionController.setProperties({ lastTransition: transition, thrown: xhrOrErr });
|
||||
|
||||
this.intermediateTransitionTo('exception');
|
||||
|
@ -0,0 +1,7 @@
|
||||
import UnknownRoute from 'discourse/routes/unknown';
|
||||
|
||||
export default UnknownRoute.extend({
|
||||
renderTemplate() {
|
||||
this.render('unknown');
|
||||
}
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user