@@ -11,18 +11,19 @@ const httpOptions = {
|
||||
})
|
||||
export class AuthService {
|
||||
constructor(private http: HttpClient) {}
|
||||
login(username: string, password: string): Observable<any> {
|
||||
login(email: string, password: string): Observable<any> {
|
||||
return this.http.post(AUTH_API + '/login', {
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
});
|
||||
}
|
||||
register(username: string, password: string): Observable<any> {
|
||||
register(email: string, username: string, password: string): Observable<any> {
|
||||
return this.http.post(
|
||||
AUTH_API + '/register',
|
||||
{
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
username,
|
||||
},
|
||||
httpOptions
|
||||
);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable, OnInit } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { delay, Observable } from 'rxjs';
|
||||
import { TokenStorageService } from './token.service';
|
||||
const API_URL = 'https://aktienbot.flokaiser.com/api/';
|
||||
@Injectable({
|
||||
@@ -12,26 +12,32 @@ export class DataService {
|
||||
private tokenStorage: TokenStorageService
|
||||
) {}
|
||||
|
||||
headers = new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
});
|
||||
|
||||
async getStockData() {
|
||||
await this.http
|
||||
.get(API_URL + 'portfolio', {
|
||||
headers: this.headers,
|
||||
responseType: 'text',
|
||||
})
|
||||
.subscribe((data) => {
|
||||
console.log(data);
|
||||
return data;
|
||||
});
|
||||
public getStockData(): Observable<any> {
|
||||
return this.http.get(API_URL + 'portfolio', {
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
||||
getKeywords(): Observable<any> {
|
||||
public getTransactionData(): Observable<any> {
|
||||
return this.http.get(API_URL + 'transactions', {
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
||||
public getKeywords(): Observable<any> {
|
||||
return this.http.get(API_URL + 'keywords', {
|
||||
headers: this.headers,
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user