I encountered an issue
Error: Unable to handle unknown Observable type
when attempting to utilize v7 Angular Fire with the latest API.
Specifically
"@angular/fire": "^7.4.1"
which corresponds to angular 14, firebase 9.Please note, I have intentionally opted not to use compat imports anywhere in my application.
import { User } from '@angular/fire/auth';
import { AuthGuard, AuthPipe, AuthPipeGenerator } from '@angular/fire/auth-guard';
const redirectUnauthorizedAndUnverifiedToAuth: AuthPipe = map((user: User | null) => {
// If user is not logged in, redirect to `auth`
// If user is logged in and email is verified, allow redirect
// If user is logged in but email is not verified, redirect to `auth/verify`
return !!user ? (user.emailVerified ? true : ['auth', 'verify']) : ['auth']
})
const routes: Routes = [
{
path: "auth",
loadChildren: () => import("./auth/auth.module").then(m => m.AuthModule)
},
{
path: "my-feature",
loadChildren: () => import("./my-feature/my-feature.module").then(m => m.MyFeatureModule),
canActivate: [AuthGuard],
data: { authGuardPipe: redirectUnauthorizedAndUnverifiedToAuth }
},
{ path: "", redirectTo: "auth", pathMatch: "full" },
{ path: "**", redirectTo: "auth" }
];