|
|
@@ -0,0 +1,41 @@ |
|
|
|
import { Injectable } from '@angular/core'; |
|
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http'; |
|
|
|
|
|
|
|
@Injectable({ |
|
|
|
providedIn: 'root' |
|
|
|
}) |
|
|
|
export class UserService { |
|
|
|
BASE_URL: string = 'https://fan-engagement.techmahindra.com'; |
|
|
|
|
|
|
|
// /like-article/:id |
|
|
|
// /bookmark-article/:id |
|
|
|
|
|
|
|
constructor( |
|
|
|
private http: HttpClient |
|
|
|
) { } |
|
|
|
|
|
|
|
likePost(postId: string) { |
|
|
|
const httpOptions = { |
|
|
|
headers: new HttpHeaders({ |
|
|
|
'Access-Control-Allow-Origin': '*', |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Authorization': 'Bearer ' + JSON.parse(localStorage.getItem('FBToken')).token |
|
|
|
}) |
|
|
|
}; |
|
|
|
|
|
|
|
return this.http.get(this.BASE_URL + '/like-article/' + postId, httpOptions).toPromise(); |
|
|
|
} |
|
|
|
|
|
|
|
getUserProfile() { |
|
|
|
const httpOptions = { |
|
|
|
headers: new HttpHeaders({ |
|
|
|
'Access-Control-Allow-Origin': '*', |
|
|
|
'Content-Type': 'application/json', |
|
|
|
'Authorization': 'Bearer ' + JSON.parse(localStorage.getItem('FBToken')).token |
|
|
|
}) |
|
|
|
}; |
|
|
|
|
|
|
|
return this.http.get(this.BASE_URL + '/user-details/', httpOptions).toPromise(); |
|
|
|
} |
|
|
|
|
|
|
|
} |