Skip to content

Instantly share code, notes, and snippets.

@Raja0sama

Raja0sama/DVA Secret

Created Nov 5, 2020
Embed
What would you like to do?
// Namespace
const namespace = "app";
// Helpers
const startLoading = (loadingType) => ({ type: "startLoading", loadingType });
const stopLoading = (loadingType) => ({ type: "stopLoading", loadingType });
export default {
namespace,
state: {
},
effects: {
// list all the effects that you want to catch. Make sure your dispatch
// type should be same as effect function
*effectFunction({ id }, {}) {
}
},
subscriptions: {
// subscription will run on the load of the model
async onLoad({ dispatch }) {
},
},
reducers: {
// reducers to setState
setState(state, newState) {
return { ...state, ...newState };
},
startLoading(state, { loadingType }) {
return { ...state, loading: { ...state.loading, [loadingType]: true } };
},
stopLoading(state, { loadingType }) {
return { ...state, loading: { ...state.loading, [loadingType]: false } };
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.