clothes.js
508 Bytes
import axios from "axios";
const CLOTHES_RECOMMEND = 'weather/RECOMMEND';
export function recommend(dataToSubmit) {
const req = axios.post('http://localhost:4000/api/clothes', dataToSubmit)
.then(res => res.data);
return {
type: CLOTHES_RECOMMEND,
payload: req,
}
}
export default function (state = {}, action) {
switch (action.type) {
case CLOTHES_RECOMMEND:
return { ...state, clothesRecommend: action.payload };
break;
default:
return state;
}
}