mirror of
https://github.com/PlayEdu/frontend.git
synced 2025-12-23 07:09:34 +08:00
登录及相关逻辑
This commit is contained in:
@@ -2,11 +2,13 @@ import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
type UserStoreInterface = {
|
||||
user: any;
|
||||
departments: any;
|
||||
isLogin: boolean;
|
||||
};
|
||||
|
||||
let defaultValue: UserStoreInterface = {
|
||||
user: null,
|
||||
departments: null,
|
||||
isLogin: false,
|
||||
};
|
||||
|
||||
@@ -17,11 +19,14 @@ const loginUserSlice = createSlice({
|
||||
},
|
||||
reducers: {
|
||||
loginAction(stage, e) {
|
||||
console.log(e);
|
||||
stage.value.user = e.payload.user;
|
||||
stage.value.departments = e.payload.departments;
|
||||
stage.value.isLogin = true;
|
||||
},
|
||||
logoutAction(stage) {
|
||||
stage.value.user = null;
|
||||
stage.value.departments = null;
|
||||
stage.value.isLogin = false;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user