Archive commit

This commit is contained in:
Erik McClure
2019-08-28 21:15:02 -07:00
commit 735845746e
1435 changed files with 140724 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { Injectable } from '@angular/core';
import { Router, CanActivate } from '@angular/router';
import { Model } from './model';
@Injectable({
providedIn: 'root',
})
export class AuthGuard implements CanActivate {
constructor(private router: Router, private model: Model) {
}
canActivate() {
return this.model.accountPromise
.then(account => {
if (account) {
return true;
} else {
this.router.navigate(['/']);
return false;
}
}) as any;
}
}