mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
updated universal-router to 7.0.0
This commit is contained in:
Vendored
+3
-2
@@ -1,8 +1,9 @@
|
||||
// Type definitions for universal-router 6.0
|
||||
// Type definitions for universal-router 7.0
|
||||
// Project: https://github.com/kriasoft/universal-router
|
||||
// Definitions by: Jack Moore <https://github.com/jtmthf>
|
||||
// Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Lodin <https://github.com/Lodin>
|
||||
// acidghost <https://github.com/acidghost>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -101,7 +102,7 @@ export interface Options<C extends Context = Context, R = any> {
|
||||
context?: C;
|
||||
baseUrl?: string;
|
||||
resolveRoute?: (context: ActionContext<C, R> & C, params: Params) => any;
|
||||
errorHandler?: (error: Error & { context: C, code: number }) => any;
|
||||
errorHandler?: (error: Error & { status: number }, context: C) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,10 +12,10 @@ new UniversalRouter(
|
||||
user: 'name',
|
||||
},
|
||||
baseUrl: '/base',
|
||||
errorHandler: (error) => {
|
||||
errorHandler: (error, context) => {
|
||||
console.error(error);
|
||||
console.dir(error.context);
|
||||
return error.code === 404
|
||||
console.dir(context);
|
||||
return error.status === 404
|
||||
? '<h1>Page Not Found</h1>'
|
||||
: '<h1>Oops! Something went wrong</h1>';
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user