fix: save and send cookie in dev setup
This commit is contained in:
@@ -7,20 +7,20 @@ import Transaction from '@model/transaction'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class APIService {
|
||||
private apiUrl = 'http://localhost:3000/api'
|
||||
private apiUrl = '/api';
|
||||
private isAuthenticatedSubject = new BehaviorSubject<boolean>(false);
|
||||
isAuthenticated$ = this.isAuthenticatedSubject.asObservable();
|
||||
|
||||
constructor(private http: HttpClient){}
|
||||
|
||||
getTransactions(): Observable<Transaction[]>{
|
||||
return this.http.get<Transaction[]>(this.apiUrl + '/transactions');
|
||||
return this.http.get<Transaction[]>(`${this.apiUrl}/transactions`);
|
||||
}
|
||||
login(username: string, password: string): Observable<any>{
|
||||
return this.http.post(this.apiUrl + '/auth/login',{ 'username': username, 'password': password});
|
||||
return this.http.post(`${this.apiUrl}/auth/login`,{ 'username': username, 'password': password});
|
||||
}
|
||||
logout(): Observable<any>{
|
||||
return this.http.post(this.apiUrl + '/auth/logout', {});
|
||||
return this.http.post(`${this.apiUrl}/auth/logout`, {});
|
||||
}
|
||||
checkAuthStatus(): Observable<boolean> {
|
||||
return this.http.get(`${this.apiUrl}/auth/status`, { withCredentials: true}).pipe(
|
||||
|
||||
Reference in New Issue
Block a user