Files
tabby-web/src/services/login.service.ts

22 lines
507 B
TypeScript
Raw Normal View History

2021-06-21 09:22:13 +02:00
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()
}
}