All files / app/core user.token.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                            1x   86x    
import { inject, InjectionToken } from '@angular/core';
import { Auth, user } from '@angular/fire/auth';
import type { User } from '@angular/fire/auth';
import type { Observable } from 'rxjs';
 
/** The Firebase User object of the currently logged in account, otherwise null. */
export type MaybeUser = User | null;
/** Observable of MaybeUser */
export type MaybeUser$ = Observable<MaybeUser>;
export type { User };
 
/**
 * Observable of yhe currently logged in Firebase User, or else null.
 */
export const USER$ = new InjectionToken<MaybeUser$>(
  'USER$',
  { factory: (): MaybeUser$ => user(inject(Auth)) },
);