mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
♻️ refactor api code
This commit is contained in:
@@ -30,15 +30,15 @@ export const login = createAsyncThunk(
|
||||
);
|
||||
|
||||
const setLoginReducer: CaseReducer<AuthStatus, PayloadAction<TokenResp>> = (state, action) => {
|
||||
if (action.payload.status === 200) {
|
||||
state.login = true;
|
||||
state.id = action.payload.id;
|
||||
state.userType = action.payload.type;
|
||||
state.token = action.payload.token;
|
||||
} else {
|
||||
state.login = false;
|
||||
state.failed = true;
|
||||
}
|
||||
state.login = true;
|
||||
state.id = action.payload.id;
|
||||
state.userType = action.payload.type;
|
||||
state.token = action.payload.token;
|
||||
};
|
||||
|
||||
export const setLoginFailedReducer: CaseReducer<AuthStatus> = (state) => {
|
||||
state.login = false;
|
||||
state.failed = true;
|
||||
};
|
||||
|
||||
export const setLogoutReducer: CaseReducer<AuthStatus> = (state) => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export interface TokenResp {
|
||||
status: number;
|
||||
token: string;
|
||||
type: string;
|
||||
id: number;
|
||||
@@ -44,7 +43,7 @@ export interface SubscribeResp {
|
||||
}
|
||||
|
||||
export interface StatusResp {
|
||||
status: number;
|
||||
ok: boolean;
|
||||
msg: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user