This commit is contained in:
Eugene Pankov
2021-06-21 09:22:13 +02:00
parent 8bae6e1769
commit 663615fe06
11 changed files with 145 additions and 22 deletions

View File

@@ -0,0 +1,21 @@
import { AsyncSubject } from 'rxjs'
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
@Injectable({ providedIn: 'root' })
export class LoginService {
user: any
ready$ = new AsyncSubject<void>()
constructor (private http: HttpClient) {
this.init()
}
private async init () {
const user = await this.http.get('/api/1/user').toPromise()
this.user = user
this.ready$.next()
this.ready$.complete()
}
}