React Boilerplate Redux Saga Hoc

Search Results

No results for 'N/A'
1. Getting Started
2. Basic Concepts
3. Handlers
3.0.1 Introduction3.0.2 Data Handler3.0.3 Infinite Handler3.0.4 Update Handler3.0.5 Update Key Handler3.0.6 Delete Handler3.0.7 Delete Key Handler3.0.8 Splice Handler3.0.9 Custom Handler# Custom Handler without filter# Custom Handler with filter# Custom Handler with Multi-filter# How to use custom handler for all the api's3.1.0 Toggle Key Handler3.1.1 Dont Update Data Handler3.1.2 callback Handler3.1.3 Dont Update Handler
4. Advanced Concepts
5. Examples6. Advanced Examples7. ParamsApi ReferenceComplete DocumentationPrevious DocumentationReadme

Custom Handler

Note:
- You are not limited to built-in handlers.
- With the help of custom handler you can create n number of handlers in you project.
- You can even share your logic in gitub for other developers to use.
- It will update existing data or create a new data based on your logic.

# Custom Handler without filter

import { HOC, commonConstants, store } from "react-boilerplate-redux-saga-hoc";
const { ON_SUCCESS } = commonConstants;
const { DEMO_API_CONFIGURATION_CUSTOM_TASK } = props;
DEMO_API_CONFIGURATION_CUSTOM_TASK(ON_SUCCESS, {
task: {
name: "Custom-Handler",
customHandler: ({ task, request, successData, errorData, status }) => ({
data = {},
} = {}) => {
return {
data: {
comment: "Hi i added comment in data",
},
};
},
},
});

# Custom Handler with filter

import { HOC, commonConstants, store } from "react-boilerplate-redux-saga-hoc";
const { ON_SUCCESS } = commonConstants;
const { DEMO_API_CONFIGURATION_CUSTOM_TASK } = props;
DEMO_API_CONFIGURATION_CUSTOM_TASK(ON_SUCCESS, {
task: {
name: "Custom-Handler",
customHandler: ({ task, request, successData, errorData, status }) => ({
data = {},
} = {}) => {
return {
data: {
comment: "Hi i added comment in data",
},
};
},
},
filter: ["name"],
});

# Custom Handler with Multi-filter

import { HOC, commonConstants, store } from "react-boilerplate-redux-saga-hoc";
const { ON_SUCCESS } = commonConstants;
const { DEMO_API_CONFIGURATION_CUSTOM_TASK } = props;
DEMO_API_CONFIGURATION_CUSTOM_TASK(ON_SUCCESS, {
task: {
name: "Custom-Handler",
customHandler: ({ task, request, successData, errorData, status }) => ({
data = {},
} = {}) => {
return newObject(data, {
data: {
comment: "Hi i added comment in data",
},
});
},
},
filter: [["filter-1"], ["filter-2"], ["filter-2"]],
});

# How to use custom handler for all the api's

import {
HOC as HocConfigure,
commonConstants,
store,
} from "react-boilerplate-redux-saga-hoc";
const { ON_SUCCESS } = commonConstants;
const handler = () => () => {};
const handler2 = () => () => {};
const HOC = HocConfigure({
handlers: [
{
name: "my-own-handler",
handler,
},
{
name: "my-own-handler-2",
handler: handler2,
},
],
});
const AuthHoc = HOC({
name: "Auth",
apiEndPoints: {},
});