JSFiddle - React, Tailwind, and code Playground
JavaScript
import {
GET_STORES,
GET_STORES_SUCCESS,
GET_STORES_FAILURE,
REMOVE_STORE,
REMOVE_STORE_SUCCESS,
REMOVE_STORE_FAILURE,
SYNC_STORE,
SYNC_STORE_SUCCESS,
SYNC_STORE_FAILURE,
} from "../../constants/store";
import { removeStore, removeStoreSuccess, removeStoreFailure } from "./removeStore";
import { syncStore, syncStoreSuccess, syncStoreFailure } from "./syncStore";
import { getStores, getStoresSuccess, getStoresFailure } from "./getStores";
const initialState = {
payload: {},
loading: false,
error: null,
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_STORES:
return getStores(state, action);
case GET_STORES_SUCCESS:
return getStoresSuccess(state, action);
case GET_STORES_FAILURE:
return getStoresFailure(state, action);
case REMOVE_STORE:
return removeStore(state, action);
case REMOVE_STORE_SUCCESS:
return removeStoreSuccess(state, action);
case REMOVE_STORE_FAILURE:
return removeStoreFailure(state, action);
case SYNC_STORE:
return syncStore(state, action);
case SYNC_STORE_SUCCESS:
return syncStoreSuccess(state, action);
case SYNC_STORE_FAILURE:
return syncStoreFailure(state, action);
default:
return state;
}
};