Refactor auth guard (#226)

pull/228/head
Thomas 3 years ago committed by GitHub
parent a3a9957196
commit d53e5c4da5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -63,6 +63,7 @@ export class AuthGuard implements CanActivate {
) { ) {
this.router.navigate(['/zen']); this.router.navigate(['/zen']);
resolve(false); resolve(false);
return;
} else if (state.url.startsWith('/start')) { } else if (state.url.startsWith('/start')) {
if (user.settings.viewMode === ViewMode.ZEN) { if (user.settings.viewMode === ViewMode.ZEN) {
this.router.navigate(['/zen']); this.router.navigate(['/zen']);
@ -71,12 +72,14 @@ export class AuthGuard implements CanActivate {
} }
resolve(false); resolve(false);
return;
} else if ( } else if (
state.url.startsWith('/zen') && state.url.startsWith('/zen') &&
user.settings.viewMode === ViewMode.DEFAULT user.settings.viewMode === ViewMode.DEFAULT
) { ) {
this.router.navigate(['/home']); this.router.navigate(['/home']);
resolve(false); resolve(false);
return;
} }
resolve(true); resolve(true);

Loading…
Cancel
Save