Add data handling for transactions and stocks

This commit is contained in:
kevinpauer
2022-04-04 23:13:02 +02:00
parent 9115908365
commit 16ad83ae40
8 changed files with 123 additions and 120 deletions

View File

@@ -88,21 +88,27 @@ export class DataService {
public createTransaction(
symbol: string,
time: string,
count: BigInt,
count: number,
price: number
): Observable<any> {
time = time + 'T12:00:00.000';
return this.http.post(API_URL + 'transactions', {
headers: new HttpHeaders({
'Content-Type': 'application/json',
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
}),
responseType: 'text',
count,
price,
symbol,
time,
});
time = time + 'T12:00:00.000Z';
price.toFixed(2);
console.log(this.tokenStorage.getToken());
return this.http.post(
API_URL + 'transaction',
{
count,
price,
symbol,
time,
},
{
headers: new HttpHeaders({
'Content-Type': 'application/json',
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
}),
}
);
}
/**

View File

@@ -1,13 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { TokenService } from './token.service';
import { TokenStorageService } from './token.service';
describe('TokenService', () => {
let service: TokenService;
describe('TokenStorageService', () => {
let service: TokenStorageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(TokenService);
service = TestBed.inject(TokenStorageService);
});
it('should be created', () => {