19 lines
398 B
TypeScript
Executable File
19 lines
398 B
TypeScript
Executable File
import { combineReducers } from "@reduxjs/toolkit";
|
|
import { LOGOUT } from "../constants/actions";
|
|
import { authSlice } from "../features";
|
|
|
|
const appReducer = combineReducers({
|
|
auth: authSlice
|
|
});
|
|
|
|
const rootReducer = (state: any, action: any) => {
|
|
if (action.type === LOGOUT) {
|
|
// remove token
|
|
state = undefined
|
|
}
|
|
|
|
return appReducer(state, action);
|
|
}
|
|
|
|
export default rootReducer;
|