Fix placeholder bug and improve code quality

This commit is contained in:
kevinpauer 2022-04-06 17:04:38 +02:00
parent b2be8745a6
commit e592a0805a
3 changed files with 6 additions and 5 deletions

View File

@ -28,7 +28,8 @@ export class HelperService {
return shares;
}
formatKeywordsData(keywords: Keyword[]) {
formatKeywordsData(): Keyword[] {
var keywords: Keyword[] = [];
this.botService.getKeywords().subscribe((result) => {
var data = JSON.parse(result);
for (let i = 0; i < data.data.length; i++) {

View File

@ -44,7 +44,7 @@
</button>
</mat-chip>
<input
placeholder="New fruit..."
placeholder="New share..."
[matChipInputFor]="sharesList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
[matChipInputAddOnBlur]="addOnBlur"

View File

@ -29,7 +29,7 @@ export class BotSettingsComponent implements OnInit {
ngOnInit(): void {
this.shares = this.helper.formatShareData();
this.helper.formatKeywordsData(this.keywords);
this.keywords = this.helper.formatKeywordsData();
}
addOnBlur = true;
@ -52,7 +52,7 @@ export class BotSettingsComponent implements OnInit {
if (value) {
await this.helper.delay(1000);
this.keywords = [];
this.keywords = this.helper.formatKeywordsData(this.keywords);
this.keywords = this.helper.formatKeywordsData();
}
}
@ -64,7 +64,7 @@ export class BotSettingsComponent implements OnInit {
await this.helper.delay(1000);
this.keywords = [];
this.keywords = this.helper.formatKeywordsData(this.keywords);
this.keywords = this.helper.formatKeywordsData();
}
async addShare(event: MatChipInputEvent): Promise<void> {