feat(auth): use async in canActivate for auth refresh
This commit is contained in:
parent
b3a4226e3b
commit
eadd831e3f
1 changed files with 2 additions and 1 deletions
|
@ -16,8 +16,9 @@ import { environment } from '../../environments/environment';
|
|||
export class AuthGuard implements CanActivate {
|
||||
constructor(private router: Router) { };
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {
|
||||
const pb = new PocketBase(environment.POCKETBASE);
|
||||
await pb.collection('users').authRefresh().catch(() => this.router.navigate(['']));
|
||||
|
||||
if (pb.authStore.isValid) {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue