Spaces:
Running
Running
| import { createSlice } from "@reduxjs/toolkit"; | |
| import { IAuthState } from "./types"; | |
| const initialState: IAuthState = { | |
| isAuth: false, | |
| userName: "", | |
| }; | |
| const authSlice = createSlice({ | |
| name: "authSlice", | |
| initialState, | |
| reducers: { | |
| setIsAuth: (state, action: { payload: boolean }) => { | |
| state.isAuth = action.payload; | |
| }, | |
| setUserName: (state, action: { payload: string }) => { | |
| state.userName = action.payload; | |
| }, | |
| }, | |
| }); | |
| export const { setIsAuth, setUserName } = authSlice.actions; | |
| export default authSlice.reducer; | |