iot-gateway_fontend/src/store/modules/auth/index.ts

56 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-11-12 15:44:05 +08:00
import { defineStore } from 'pinia';
import {
2024-12-24 17:13:37 +08:00
AuthCreateRecord,
AuthRecord,
create,
queryAuthList,
enabled,
remove,
update,
getDetail,
} from '@/api/authority';
import { authStore } from './type';
2024-11-12 15:44:05 +08:00
2024-12-24 17:13:37 +08:00
const useAuthStore = defineStore('auth', {
state: (): authStore => ({
id: undefined,
remark: undefined,
// createTime: undefined,
name: undefined,
enabled: undefined,
}),
getters: {
AuthInfo(state: authStore): authStore {
return { ...state };
},
},
actions: {
// 获取所有的角色列表
async getAuthList(data: AuthRecord) {
return queryAuthList(data);
},
async enabledAuth(id: string) {
return enabled(id);
},
async removeAuth(id: string) {
return remove(id);
},
async createAuth(params: AuthCreateRecord) {
return create(params);
},
async updateAuth(params: AuthRecord) {
return update(params);
2024-11-12 15:44:05 +08:00
},
2024-12-24 17:13:37 +08:00
async getAuthDetail(id: string) {
return getDetail(id);
2024-11-12 15:44:05 +08:00
},
2024-12-24 17:13:37 +08:00
},
});
2024-11-12 15:44:05 +08:00
2024-12-24 17:13:37 +08:00
export default useAuthStore;