28 lines
575 B
TypeScript
28 lines
575 B
TypeScript
import { defineStore } from 'pinia';
|
|
|
|
export interface TenantState {
|
|
id: string | null;
|
|
domain: string | null;
|
|
label: string | null;
|
|
}
|
|
|
|
export const useTenantStore = defineStore('tenantStore', {
|
|
state: () => ({
|
|
tenant: null as TenantState | null,
|
|
}),
|
|
actions: {
|
|
init(tenant: Partial<TenantState> | null) {
|
|
this.tenant = tenant
|
|
? {
|
|
id: tenant.id ?? null,
|
|
domain: tenant.domain ?? null,
|
|
label: tenant.label ?? null,
|
|
}
|
|
: null;
|
|
},
|
|
reset() {
|
|
this.tenant = null;
|
|
},
|
|
},
|
|
});
|