Backend authentication
This commit is contained in:
@@ -15,10 +15,9 @@ export class AuthService {
|
||||
private http$: HttpClient
|
||||
) { }
|
||||
|
||||
loadDbUser() {
|
||||
ping() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const headers = new HttpHeaders({
|
||||
// 'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${this.apiToken}`
|
||||
})
|
||||
this.http$.get<any>(`${environment.api.url}/ping/ping`, {
|
||||
@@ -43,7 +42,7 @@ export class AuthService {
|
||||
const header = new HttpHeaders().set('Content-type', 'application/json');
|
||||
this.http$.post<any>(`${environment.api.url}/auth/apiToken`, JSON.stringify(credentials), { headers: header }).subscribe({
|
||||
next: (data) => {
|
||||
console.log('apiToken', data);
|
||||
if (this.user) { this.user.id = data.id }
|
||||
this.apiToken = data.token;
|
||||
resolve(data);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user