mirror of https://github.com/abpframework/abp.git
15 changed files with 76 additions and 112 deletions
@ -1,16 +0,0 @@ |
|||
import { Injectable } from '@angular/core'; |
|||
import { Resolve } from '@angular/router'; |
|||
import { Store } from '@ngxs/store'; |
|||
import { GetRoles } from '../actions/identity.actions'; |
|||
import { Identity } from '../models/identity'; |
|||
import { IdentityState } from '../states/identity.state'; |
|||
|
|||
@Injectable() |
|||
export class RoleResolver implements Resolve<Identity.State> { |
|||
constructor(private store: Store) {} |
|||
|
|||
resolve() { |
|||
const roles = this.store.selectSnapshot(IdentityState.getRoles); |
|||
return roles && roles.length ? null : this.store.dispatch(new GetRoles()); |
|||
} |
|||
} |
|||
@ -1,16 +0,0 @@ |
|||
import { Injectable } from '@angular/core'; |
|||
import { Resolve } from '@angular/router'; |
|||
import { Store } from '@ngxs/store'; |
|||
import { GetUsers } from '../actions/identity.actions'; |
|||
import { Identity } from '../models/identity'; |
|||
import { IdentityState } from '../states/identity.state'; |
|||
|
|||
@Injectable() |
|||
export class UserResolver implements Resolve<Identity.State> { |
|||
constructor(private store: Store) {} |
|||
|
|||
resolve() { |
|||
const users = this.store.selectSnapshot(IdentityState.getUsers); |
|||
return users && users.length ? null : this.store.dispatch(new GetUsers()); |
|||
} |
|||
} |
|||
@ -1 +0,0 @@ |
|||
export * from './tenants.resolver'; |
|||
@ -1,16 +0,0 @@ |
|||
import { Injectable } from '@angular/core'; |
|||
import { Resolve } from '@angular/router'; |
|||
import { Store } from '@ngxs/store'; |
|||
import { GetTenants } from '../actions/tenant-management.actions'; |
|||
import { TenantManagement } from '../models/tenant-management'; |
|||
import { TenantManagementState } from '../states/tenant-management.state'; |
|||
|
|||
@Injectable() |
|||
export class TenantsResolver implements Resolve<TenantManagement.State> { |
|||
constructor(private store: Store) {} |
|||
|
|||
resolve() { |
|||
const data = this.store.selectSnapshot(TenantManagementState.get); |
|||
return data && data.length ? null : this.store.dispatch(new GetTenants()); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue