From eadd831e3f1e0c2082d0a7ee3acfedf7f40fea74 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Mon, 20 Jan 2025 10:09:44 +0100 Subject: [PATCH 1/2] feat(auth): use async in canActivate for auth refresh --- src/app/service/auth.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/service/auth.service.ts b/src/app/service/auth.service.ts index 5181a8f..6c926df 100644 --- a/src/app/service/auth.service.ts +++ b/src/app/service/auth.service.ts @@ -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 { const pb = new PocketBase(environment.POCKETBASE); + await pb.collection('users').authRefresh().catch(() => this.router.navigate([''])); if (pb.authStore.isValid) { return true; From 9bc5ed62ffbfda02cc83eaa40d82b7bc40470c70 Mon Sep 17 00:00:00 2001 From: Jan Klattenhoff Date: Mon, 20 Jan 2025 14:15:28 +0100 Subject: [PATCH 2/2] chore: update production PocketBase URL --- src/environments/environment.production.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index 5a76b29..9928ed1 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -1,3 +1,3 @@ export const environment = { - POCKETBASE: 'http://pocketbase-oowogg0wo4gw04sss44gos4o.192.168.178.105.sslip.io/', + POCKETBASE: 'http://pocketbase-prod-jktime-oowogg0wo4gw04sss44gos4o.192.168.178.105.sslip.io/', };