diff options
Diffstat (limited to 'packages/client/src/nirax.ts')
| -rw-r--r-- | packages/client/src/nirax.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/client/src/nirax.ts b/packages/client/src/nirax.ts index 9dc787de4e..19c4464ea8 100644 --- a/packages/client/src/nirax.ts +++ b/packages/client/src/nirax.ts @@ -2,11 +2,13 @@ import { EventEmitter } from 'eventemitter3'; import { Ref, Component, ref, shallowRef, ShallowRef } from 'vue'; +import { pleaseLogin } from '@/scripts/please-login'; type RouteDef = { path: string; component: Component; query?: Record<string, string>; + loginRequired?: boolean; name?: string; hash?: string; globalCacheKey?: string; @@ -169,6 +171,10 @@ export class Router extends EventEmitter<{ throw new Error('no route found for: ' + path); } + if (res.route.loginRequired) { + pleaseLogin('/'); + } + const isSamePath = beforePath === path; if (isSamePath && key == null) key = this.currentKey; this.currentComponent = res.route.component; |