mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-05-17 03:48:06 +08:00
Changed auth slice to status slice to better reflect onboarding state tracking
This commit is contained in:
parent
90f227a2c0
commit
b30bbb62df
6 changed files with 38 additions and 35 deletions
|
@ -1,10 +1,10 @@
|
|||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import AuthReducer from "../slices/AuthSlice/AuthSlice";
|
||||
import StatusReducer from "../slices/StatusSlice/StatusSlice";
|
||||
import UserReducer from "../slices/UserSlice/UserSlice";
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
auth: AuthReducer,
|
||||
status: StatusReducer,
|
||||
user: UserReducer,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
export const AuthSlice = createSlice({
|
||||
name: "Auth",
|
||||
initialState: {
|
||||
creds: {
|
||||
logged_in: false,
|
||||
},
|
||||
},
|
||||
reducers: {
|
||||
login: (state) => {
|
||||
state.creds.logged_in = true;
|
||||
},
|
||||
logout: (state) => {
|
||||
state.creds.logged_in = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Action creators are generated for each case reducer function
|
||||
export const { login, logout } = AuthSlice.actions;
|
||||
|
||||
export default AuthSlice.reducer;
|
28
src/features/redux/slices/StatusSlice/StatusSlice.tsx
Normal file
28
src/features/redux/slices/StatusSlice/StatusSlice.tsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
export const StatusSlice = createSlice({
|
||||
name: "Status",
|
||||
initialState: {
|
||||
logged_in: false,
|
||||
onboarding: false,
|
||||
},
|
||||
reducers: {
|
||||
login: (state) => {
|
||||
state.logged_in = true;
|
||||
},
|
||||
logout: (state) => {
|
||||
state.logged_in = false;
|
||||
},
|
||||
onboard: (state) => {
|
||||
state.onboarding = true;
|
||||
},
|
||||
not_onboard: (state) => {
|
||||
state.onboarding = false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Action creators are generated for each case reducer function
|
||||
export const { login, logout, onboard, not_onboard } = StatusSlice.actions;
|
||||
|
||||
export default StatusSlice.reducer;
|
Loading…
Add table
Add a link
Reference in a new issue