26 lines
723 B
TypeScript
26 lines
723 B
TypeScript
import {inject, Injectable} from '@angular/core';
|
|
import {HttpClient} from '@angular/common/http';
|
|
import {Observable} from 'rxjs';
|
|
import {OnboardRequest, User} from '../models/users.models';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class UserService {
|
|
|
|
httpClient: HttpClient = inject(HttpClient)
|
|
|
|
getCurrentUser(): Observable<User> {
|
|
return this.httpClient.get<User>(`http://localhost:8000/users/current`)
|
|
}
|
|
|
|
getUserById(userId: string): Observable<User> {
|
|
return this.httpClient.get<User>(`http://localhost:8000/users/profile/${userId}`)
|
|
}
|
|
|
|
onboardUser(payload: OnboardRequest): Observable<User>{
|
|
return this.httpClient.post<User>(`http://localhost:8000/users/onboarding`, payload)
|
|
}
|
|
|
|
}
|