muryshev's picture
init
79278ec
raw
history blame contribute delete
555 Bytes
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;