fix(core): store tenant instead of tenant id

pull/1578/head
TheDiaval 6 years ago
parent dffc71bcf2
commit b1c30fdcd1

@ -1,8 +1,10 @@
import { ABP } from '../models';
export class SessionSetLanguage {
static readonly type = '[Session] Set Language';
constructor(public payload: string) {}
}
export class SessionSetTenantId {
static readonly type = '[Session] Set Tenant Id';
constructor(public payload: string) {}
export class SessionSetTenant {
static readonly type = '[Session] Set Tenant';
constructor(public payload: ABP.BasicItem) {}
}

@ -1,6 +1,8 @@
import { ABP } from '../models';
export namespace Session {
export interface State {
language: string;
tenantId: string;
tenant: ABP.BasicItem;
}
}

@ -1,6 +1,6 @@
import { Action, Selector, State, StateContext } from '@ngxs/store';
import { SessionSetLanguage, SessionSetTenantId } from '../actions/session.actions';
import { Session } from '../models/session';
import { SessionSetLanguage, SessionSetTenant } from '../actions/session.actions';
import { ABP, Session } from '../models';
@State<Session.State>({
name: 'SessionState',
@ -13,8 +13,8 @@ export class SessionState {
}
@Selector()
static getSelectedTenantId({ tenantId }: Session.State): string {
return tenantId;
static getTenant({ tenant }: Session.State): ABP.BasicItem {
return tenant;
}
constructor() {}
@ -26,10 +26,10 @@ export class SessionState {
});
}
@Action(SessionSetTenantId)
sessionSetTenantId({ patchState }: StateContext<Session.State>, { payload }: SessionSetTenantId) {
@Action(SessionSetTenant)
sessionSetTenantId({ patchState }: StateContext<Session.State>, { payload }: SessionSetTenant) {
patchState({
tenantId: payload,
tenant: payload,
});
}
}

Loading…
Cancel
Save