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