mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
16 lines
342 B
TypeScript
16 lines
342 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { BehaviorSubject } from 'rxjs';
|
|
import { User } from './user.model';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class UserStore {
|
|
private user = new BehaviorSubject<User | undefined>(undefined);
|
|
user$ = this.user.asObservable();
|
|
|
|
add(user: User) {
|
|
this.user.next(user);
|
|
}
|
|
}
|