Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit 3304ab3

Browse files
committed
feat(fire): redirect if on login page and authed
1 parent 3482c5f commit 3304ab3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/fire/src/app/auth/containers/auth-login/auth-login.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,19 @@ export class AuthLoginComponent {
3838
public error = null
3939

4040
constructor(public auth: AuthService, private router: Router) {
41+
this.auth.authState$
42+
.subscribe((user) => user && this.redirect())
43+
}
44+
45+
redirect() {
46+
this.router.navigate(['/auth'])
4147
}
4248

4349
login(provider) {
4450
this.error = false
4551
this.auth.login(provider)
4652
.subscribe(
47-
() => this.router.navigate(['/auth']),
53+
() => this.redirect(),
4854
err => this.error = err.message
4955
);
5056
}

0 commit comments

Comments
 (0)