Fix shares and keywords
This commit is contained in:
parent
4788159865
commit
7bcfdc4081
@ -21,7 +21,7 @@ export class HelperService {
|
||||
var data = JSON.parse(result);
|
||||
for (let i = 0; i < data.data.length; i++) {
|
||||
shares.push({
|
||||
symbol: data.data[i].symbol,
|
||||
isin: data.data[i].isin,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -79,11 +79,12 @@ export class BotService {
|
||||
* @param {string} keyword
|
||||
* @returns Observable
|
||||
*/
|
||||
public createShare(symbol: string): Observable<any> {
|
||||
public createShare(isin: string, comment: string): Observable<any> {
|
||||
return this.http.post(
|
||||
API_URL + 'share',
|
||||
{
|
||||
symbol,
|
||||
comment,
|
||||
isin,
|
||||
},
|
||||
{
|
||||
headers: new HttpHeaders({
|
||||
|
@ -67,7 +67,7 @@
|
||||
*ngFor="let share of shares"
|
||||
(removed)="removeShare(share)"
|
||||
>
|
||||
{{ share.symbol }}
|
||||
{{ share.isin }}
|
||||
<button matChipRemove>
|
||||
<mat-icon>cancel</mat-icon>
|
||||
</button>
|
||||
|
@ -14,7 +14,7 @@ export interface Fruit {
|
||||
}
|
||||
|
||||
export interface Share {
|
||||
symbol: string;
|
||||
isin: string;
|
||||
}
|
||||
|
||||
export interface Keyword {
|
||||
@ -80,9 +80,9 @@ export class BotSettingsComponent implements OnInit {
|
||||
const value = (event.value || '').trim();
|
||||
|
||||
// Add share to database
|
||||
if (value && !this.shares.includes({ symbol: value.toLowerCase() })) {
|
||||
if (value && !this.shares.includes({ isin: value.toLowerCase() })) {
|
||||
console.log('Added: ' + value);
|
||||
this.botService.createShare(value).subscribe((result) => {
|
||||
this.botService.createShare(value, 'Comment').subscribe((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
@ -99,7 +99,7 @@ export class BotSettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async removeShare(share: Share): Promise<void> {
|
||||
this.botService.deleteShare(share.symbol).subscribe((result) => {
|
||||
this.botService.deleteShare(share.isin).subscribe((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user