React Boilerplate Redux Saga Hoc

Search Results

No results for 'N/A'
1. Getting Started
2. Basic Concepts
3. Handlers
4. Advanced Concepts
4.0.1 Creating Custom Reducer4.0.2 Modifying api end points reducer constants4.0.3 Don't reset on setting to initial state# Don't reset on setting to initial state4.0.4 Cancelling Api Calls4.0.5 Axios Interceptors4.0.6 Inject saga and reducer to the store4.0.7 Inject saga and reducer to the store by using hooks4.0.8 Util Functions4.0.9 PARAMS4.1.0 Handling Multiple tasks
5. Examples6. Advanced Examples7. ParamsApi ReferenceComplete DocumentationPrevious DocumentationReadme

# Don't reset on setting to initial state

import { HOC, commonConstants, store } from "react-boilerplate-redux-saga-hoc";
const TEST_API = {};
const REGISTER_API = {
url: `users/user-signup/`,
method: "POST",
};
const AuthenticationHOC = HOC({
initialState: {
profile: {},
},
dontReset: {
REGISTER_API,
},
apiEndPoints: {
TEST_API,
REGISTER_API,
},
constantReducer: ({
type,
state,
action,
constants,
initialState,
resetState,
}) => {
if (type === "LOGOUT") return resetState; // it will only reset TEST_API to initial state
return state;
},
name: "Auth",
});
/*
Example:
const { dispatch } = props;
dispatch({ type: 'LOGOUT' });
*/