mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
dashboard: add staff vuex store
This commit is contained in:
parent
d03d729438
commit
f90ee12b9f
3 changed files with 44 additions and 0 deletions
24
dashboard/src/store/staff.ts
Normal file
24
dashboard/src/store/staff.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { get, post } from "../api";
|
||||
import { Module } from "vuex";
|
||||
import { RootState, StaffState } from "./types";
|
||||
|
||||
export const StaffStore: Module<StaffState, RootState> = {
|
||||
namespaced: true,
|
||||
|
||||
state: {
|
||||
isStaff: false,
|
||||
},
|
||||
|
||||
actions: {
|
||||
async checkStatus({ commit }) {
|
||||
const status = await get("staff/status");
|
||||
commit("setStatus", status.isStaff);
|
||||
},
|
||||
},
|
||||
|
||||
mutations: {
|
||||
setStatus(state: StaffState, value: boolean) {
|
||||
state.isStaff = value;
|
||||
},
|
||||
},
|
||||
};
|
|
@ -24,6 +24,10 @@ export interface GuildState {
|
|||
};
|
||||
}
|
||||
|
||||
export interface StaffState {
|
||||
isStaff: boolean;
|
||||
}
|
||||
|
||||
export interface ThinDocsPlugin {
|
||||
name: string;
|
||||
info: {
|
||||
|
@ -57,4 +61,5 @@ export type RootState = {
|
|||
auth: AuthState;
|
||||
guilds: GuildState;
|
||||
docs: DocsState;
|
||||
staff: StaffState;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue