mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-18 23:36:05 +01:00
22 lines
507 B
TypeScript
22 lines
507 B
TypeScript
|
|
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()
|
||
|
|
}
|
||
|
|
}
|