mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-20 01:10:13 +01:00
Profile creation part done.
This commit is contained in:
parent
39385049e5
commit
f75e93e3eb
10 changed files with 1000 additions and 486 deletions
59
src/app/service/api/user-api.service.ts
Normal file
59
src/app/service/api/user-api.service.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserAPI {
|
||||
|
||||
private baseUrl = 'http://localhost:8080/api';
|
||||
private token: string;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
this.token = localStorage.getItem('accessToken');
|
||||
}
|
||||
|
||||
// Saving user details
|
||||
saveUserDetails(data: any): Observable<any> {
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.post(`${this.baseUrl}/users`, data, { headers });
|
||||
}
|
||||
|
||||
// Get single user
|
||||
getUserDetails(userId: string): Observable<any> {
|
||||
console.log(userId)
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.get<any>(`${this.baseUrl}/users/${userId}`, { headers });
|
||||
}
|
||||
|
||||
saveExperience(data: any, userId: string): Observable<any> {
|
||||
console.log(userId)
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.post(`${this.baseUrl}/experiences?userId=${userId}`, data, { headers });
|
||||
}
|
||||
|
||||
saveEducation(data: any, userId: string): Observable<any> {
|
||||
console.log(userId)
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.post(`${this.baseUrl}/education?userId=${userId}`, data, { headers });
|
||||
}
|
||||
|
||||
saveProjects(data: any, userId: string): Observable<any> {
|
||||
console.log(userId)
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.post(`${this.baseUrl}/projects?userId=${userId}`, data, { headers });
|
||||
}
|
||||
|
||||
saveSkills(data: any, userId: string): Observable<any> {
|
||||
console.log(userId)
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.post(`${this.baseUrl}/skills?userId=${userId}`, data, { headers });
|
||||
}
|
||||
|
||||
saveCertifications(data: any, userId: string): Observable<any> {
|
||||
console.log(userId)
|
||||
const headers = new HttpHeaders().set('Authorization', `Bearer ${this.token}`);
|
||||
return this.http.post(`${this.baseUrl}/certifications?userId=${userId}`, data, { headers });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue