Skip to content

Commit fdb3003

Browse files
committed
fix: Fix context check for potential errors
1 parent c223ebd commit fdb3003

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/router-service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ export class RouterService {
125125
this.frame = frame;
126126

127127
this.routerGuardsService = new RouterGuardsService({
128-
to: "",
129-
from: "",
128+
to: null,
129+
from: null,
130130
});
131131
}
132132

@@ -540,14 +540,14 @@ export class RouterService {
540540
return false;
541541
}
542542

543-
if (typeof context === "object" || typeof context === "string") {
544-
this.navigateTo(context);
543+
if (context instanceof Error) {
544+
this.onError(context);
545545

546546
return false;
547547
}
548548

549-
if (context instanceof Error) {
550-
this.onError(context);
549+
if (typeof context === "object" || typeof context === "string") {
550+
this.navigateTo(context);
551551

552552
return false;
553553
}

src/typings/router-service.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface RouteOptions extends NavigationEntryVue {
3333

3434
export interface Route extends RouteOptions {
3535
path: string;
36-
name?: string;
36+
name?: RouteRecordName | null | undefined;
3737
component?: Component;
3838
children?: RouteChildren;
3939

0 commit comments

Comments
 (0)