Login fix and rename columns in DB
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { User } from '../models/user.model';
|
||||
|
||||
@@ -12,7 +13,7 @@ export class AuthService {
|
||||
user!: User;
|
||||
|
||||
constructor(
|
||||
private http$: HttpClient
|
||||
private http$: HttpClient,
|
||||
) { }
|
||||
|
||||
ping() {
|
||||
@@ -33,20 +34,17 @@ export class AuthService {
|
||||
getAPIToken(credentials: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const header = new HttpHeaders().set('Content-type', 'application/json');
|
||||
this.http$.post<any>(`${environment.api.url}/auth/apiToken`, JSON.stringify(credentials), { headers: header }).subscribe({
|
||||
this.http$.post<any>(`${environment.api.url}/auth/apiToken`, JSON.stringify(credentials), { headers: header }).subscribe({
|
||||
next: (data) => {
|
||||
this.user.id = data.id;
|
||||
this.apiToken = data.token;
|
||||
resolve(data);
|
||||
},
|
||||
error: (e) => {
|
||||
console.error('apiToken error', e);
|
||||
error: (e: HttpErrorResponse) => {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
//const header = new HttpHeaders().set('Content-type', 'application/json');
|
||||
//return this.httpClient.post(this.path + "LoginWithGoogle", JSON.stringify(credentials), { headers: header });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user