You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I want to add page 404. But I do not know if I did it right or not.
To do this, I add the following line. { path: "(.*)", load: () => import(/* webpackChunkName: 'not-found' */ "./not-found"), // action: () => '<h1>Not Found</h1>' },
I also designed not-found.js
The following code is the contents of my router.js:
`import UniversalRouter from 'universal-router';
import routes from './routes';
import { goTo } from './util/generalUtil';
export default new UniversalRouter(routes, {
resolveRoute(context, params) {
console.log("context.route 😍😍😍", context.route)
if (typeof context.route.load === 'function') {
return context.route
.load()
.then(action => action.default(context, params));
}
// else {
// console.log("😢😢😢😢😢")
// goTo("./not-found")
// }
if (typeof context.route.action === 'function') {
return context.route.action(context, params);
}
return undefined;
},
});
`
The following error occurs when testing:
The text was updated successfully, but these errors were encountered:
Hi
I want to add page 404. But I do not know if I did it right or not.
To do this, I add the following line.
{ path: "(.*)", load: () => import(/* webpackChunkName: 'not-found' */ "./not-found"), // action: () => '<h1>Not Found</h1>' },
I also designed not-found.js
The following code is the contents of my router.js:
`import UniversalRouter from 'universal-router';
import routes from './routes';
import { goTo } from './util/generalUtil';
export default new UniversalRouter(routes, {
resolveRoute(context, params) {
console.log("context.route 😍😍😍", context.route)
if (typeof context.route.load === 'function') {
return context.route
.load()
.then(action => action.default(context, params));
}
// else {
// console.log("😢😢😢😢😢")
// goTo("./not-found")
// }
if (typeof context.route.action === 'function') {
return context.route.action(context, params);
}
return undefined;
},
});
`
The following error occurs when testing:
The text was updated successfully, but these errors were encountered: