blob: 16fc90a2e0c776c8cda14e75dcef0017969a0217 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import API_SETTINGS from '../../config.json';
import User from '../_data/User';
import { AuthService } from './auth.service';
@Injectable({
providedIn: 'root'
})
export class UserInfoService {
constructor(private http: HttpClient, private authService: AuthService) { }
getUserInfo(): Observable<User> {
return this.http.get<User>(`${API_SETTINGS.apiURL}/user/myprofile`, { headers: this.authService.authHeader() });
}
changeUserInfo(user: User): any {
return this.http.put(`${API_SETTINGS.apiURL}/user/changeinfo`, user, { headers: this.authService.authHeader() });
}
changeUserPassword(passwordArray: string[]): any {
return this.http.put(`${API_SETTINGS.apiURL}/user/changepass`, passwordArray, { headers: this.authService.authHeader(), responseType: 'text' });
}
deleteUser(): any {
return this.http.delete(`${API_SETTINGS.apiURL}/user/deleteprofile`, { headers: this.authService.authHeader() });
}
}
|