Browse Source

refactor(account): fix lint errors tenant-box

pull/1826/head
mehmet-erim 7 years ago
parent
commit
1013d5ea2b
  1. 33
      npm/ng-packs/packages/account/src/lib/components/tenant-box/tenant-box.component.ts

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

@ -9,10 +9,14 @@ import { AccountService } from '../../services/account.service';
@Component({ @Component({
selector: 'abp-tenant-box', selector: 'abp-tenant-box',
templateUrl: './tenant-box.component.html', templateUrl: './tenant-box.component.html'
}) })
export class TenantBoxComponent implements OnInit { export class TenantBoxComponent implements OnInit {
constructor(private store: Store, private toasterService: ToasterService, private accountService: AccountService) {} constructor(
private store: Store,
private toasterService: ToasterService,
private accountService: AccountService
) {}
tenant = {} as ABP.BasicItem; tenant = {} as ABP.BasicItem;
@ -21,7 +25,9 @@ export class TenantBoxComponent implements OnInit {
isModalVisible: boolean; isModalVisible: boolean;
ngOnInit() { ngOnInit() {
this.tenant = this.store.selectSnapshot(SessionState.getTenant) || ({} as ABP.BasicItem); this.tenant =
this.store.selectSnapshot(SessionState.getTenant) ||
({} as ABP.BasicItem);
this.tenantName = this.tenant.name || ''; this.tenantName = this.tenant.name || '';
} }
@ -37,24 +43,31 @@ export class TenantBoxComponent implements OnInit {
take(1), take(1),
catchError(err => { catchError(err => {
this.toasterService.error( this.toasterService.error(
snq(() => err.error.error_description, 'AbpUi::DefaultErrorMessage'), snq(
'AbpUi::Error', () => err.error.error_description,
'AbpUi::DefaultErrorMessage'
),
'AbpUi::Error'
); );
return throwError(err); return throwError(err);
}), })
) )
.subscribe(({ success, tenantId }) => { .subscribe(({ success, tenantId }) => {
if (success) { if (success) {
this.tenant = { this.tenant = {
id: tenantId, id: tenantId,
name: this.tenant.name, name: this.tenant.name
}; };
this.tenantName = this.tenant.name; this.tenantName = this.tenant.name;
this.isModalVisible = false; this.isModalVisible = false;
} else { } else {
this.toasterService.error(`AbpUiMultiTenancy::GivenTenantIsNotAvailable`, 'AbpUi::Error', { this.toasterService.error(
messageLocalizationParams: [this.tenant.name], 'AbpUiMultiTenancy::GivenTenantIsNotAvailable',
}); 'AbpUi::Error',
{
messageLocalizationParams: [this.tenant.name]
}
);
this.tenant = {} as ABP.BasicItem; this.tenant = {} as ABP.BasicItem;
} }
this.store.dispatch(new SetTenant(success ? this.tenant : null)); this.store.dispatch(new SetTenant(success ? this.tenant : null));

Loading…
Cancel
Save