框架更新
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 小程序信息 store
|
||||
*/
|
||||
import {defineStore} from 'pinia';
|
||||
import {getMpInfo} from '@/api/layout';
|
||||
import type {MpInfo} from "@/api/cms/mp/model";
|
||||
|
||||
export interface UserState {
|
||||
mpInfo: MpInfo | null;
|
||||
}
|
||||
|
||||
export const useMpStore = defineStore({
|
||||
id: 'mp',
|
||||
state: (): UserState => ({
|
||||
// 小程序
|
||||
mpInfo: null,
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
/**
|
||||
* 请求用户信息、权限、角色、菜单
|
||||
*/
|
||||
async fetchMpInfo() {
|
||||
const info = await getMpInfo().catch(() => void 0);
|
||||
if (!info) {
|
||||
return {};
|
||||
}
|
||||
// 租户信息
|
||||
this.mpInfo = info;
|
||||
return info;
|
||||
},
|
||||
/**
|
||||
* 更新租户信息
|
||||
*/
|
||||
setInfo(value: MpInfo) {
|
||||
this.mpInfo = value;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user