From 5b02ef0b0c566389e476596fa322e7a25d514af1 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Wed, 4 Jan 2023 14:50:52 -0600 Subject: [PATCH] Improve message for token generation --- src/app/settings/settings.component.ts | 20 ++++++++++++++++++-- src/app/woocommerce.service.ts | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 98d1f5a..0ea9ee6 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -220,8 +220,24 @@ export class SettingsComponent implements OnInit { } generateWooToken(){ - this.wooService.createWooToken(this.owner._id!); - this.wooService.getWooToken(this.owner._id!); + this.wooService.createWooToken(this.owner._id!).subscribe(responseData => { + if (responseData.status == 202) { + this.notifierService.showNotification("WooCommerce Token generated!", "Close", "success"); + this.wooService.getWooToken(this.owner._id!); + this.wooOwnerUpdate.subscribe(owData => { + this.wooOwner = owData; + }); + this.wooTokenUpdate.subscribe(tkData => { + this.wooToken = tkData; + }); + this.wooUrlUpdate.subscribe(uData => { + this.wooUrl = uData; + }); + close(); + } else { + this.notifierService.showNotification("WooCommerce Token generation failed.", "Close", "error"); + } + }); } saveAccCod() { diff --git a/src/app/woocommerce.service.ts b/src/app/woocommerce.service.ts index b519c17..a25c13d 100644 --- a/src/app/woocommerce.service.ts +++ b/src/app/woocommerce.service.ts @@ -60,6 +60,6 @@ export class WoocommerceService { console.log('WooToken creation failed.'); } }); - + return obs; } }