Extracted frontend from webservice to new directory
Updated directory structure Updated .gitignore
This commit is contained in:
30
frontend/src/app/Services/auth.service.ts
Normal file
30
frontend/src/app/Services/auth.service.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
const AUTH_API = 'https://aktienbot.flokaiser.com/api/';
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
};
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AuthService {
|
||||
constructor(private http: HttpClient) {}
|
||||
login(username: string, password: string): Observable<any> {
|
||||
return this.http.post(AUTH_API + 'login', {
|
||||
username,
|
||||
password,
|
||||
});
|
||||
}
|
||||
register(username: string, password: string): Observable<any> {
|
||||
return this.http.post(
|
||||
AUTH_API + 'signup',
|
||||
{
|
||||
username,
|
||||
password,
|
||||
},
|
||||
httpOptions
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user