Users: get current user, onboard current user features
This commit is contained in:
25
src/app/users/services/user.ts
Normal file
25
src/app/users/services/user.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user