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; return shares;
} }
formatKeywordsData(keywords: Keyword[]) { formatKeywordsData(): Keyword[] {
var keywords: Keyword[] = [];
this.botService.getKeywords().subscribe((result) => { this.botService.getKeywords().subscribe((result) => {
var data = JSON.parse(result); var data = JSON.parse(result);
for (let i = 0; i < data.data.length; i++) { for (let i = 0; i < data.data.length; i++) {

View File

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

View File

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