Browse Source

refactor(account): tenant dispatch

pull/1573/head
TheDiaval 7 years ago
parent
commit
903b27e6a9
  1. 5
      npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts

5
npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts

@ -26,7 +26,7 @@ export class TenantBoxComponent {
} }
save() { save() {
this.selected.name = this.selected.name ? this.selected.name : ''; this.selected.name = this.selected.name || '';
this.accountService this.accountService
.findTenant(this.selected.name) .findTenant(this.selected.name)
@ -39,13 +39,12 @@ export class TenantBoxComponent {
) )
.subscribe(({ success, tenantId }) => { .subscribe(({ success, tenantId }) => {
if (success) { if (success) {
this.store.dispatch(new SessionSetTenantId(tenantId));
this.isModalVisible = false; this.isModalVisible = false;
} else { } else {
this.toasterService.error(`Given tenant is not available: ${this.selected.name}`, 'Error'); this.toasterService.error(`Given tenant is not available: ${this.selected.name}`, 'Error');
this.selected = {} as ABP.BasicItem; this.selected = {} as ABP.BasicItem;
this.store.dispatch(new SessionSetTenantId(null));
} }
this.store.dispatch(new SessionSetTenantId(success ? tenantId : null));
}); });
} }
} }

Loading…
Cancel
Save