Skip to content

Instantly share code, notes, and snippets.

@tobychung
Created June 7, 2018 02:36
Show Gist options
  • Save tobychung/80653c04177ce5ff168371e20b7a2bad to your computer and use it in GitHub Desktop.
Save tobychung/80653c04177ce5ff168371e20b7a2bad to your computer and use it in GitHub Desktop.
for Jimmy
import { RSAA } from 'redux-api-middleware';
import _ from 'lodash';
import * as types from './actionTypes';
export const getProductsWithCondition = (cateNum, colKey, colValue) => async (dispatch) => {
const response = await dispatch({
[RSAA]: {
endpoint: '/getProductsWithCondition',
method: 'POST',
body: JSON.stringify({ cateNum, colKey, colValue }),
headers: { 'Content-Type': 'application/json' },
types: types.GET_PRODUCTS_WITH_CONDITION
}
});
if (_.isUndefined(response) || !response.payload.success) {
console.error('getProductsWithCondition 失敗');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment