Add data handling for transactions and stocks
This commit is contained in:
@@ -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(),
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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', () => {
|
||||
|
Reference in New Issue
Block a user