Initial commit
This commit is contained in:
22
src/features/error/appErrorSlice.ts
Normal file
22
src/features/error/appErrorSlice.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
export type AppErrorState = {
|
||||
errorCode: number;
|
||||
};
|
||||
|
||||
const initialState: AppErrorState = {
|
||||
errorCode: 200,
|
||||
};
|
||||
|
||||
export const appErrorSlice = createSlice({
|
||||
name: "appError",
|
||||
initialState,
|
||||
reducers: {
|
||||
setErrorCode(state, action: PayloadAction<number>) {
|
||||
state.errorCode = action.payload;
|
||||
// if(errorCode === 401 && store.getState().auth.isActivated)dispach()
|
||||
},
|
||||
},
|
||||
});
|
||||
export const { setErrorCode } = appErrorSlice.actions;
|
||||
export default appErrorSlice.reducer;
|
||||
Reference in New Issue
Block a user