Authored by 于良

重复领券时 刷新优惠券状态 review by 草莓

... ... @@ -198,9 +198,8 @@ export function getCouponFailure(error) {
export function getCoupon(couponID) {
return (dispatch, getState) => {
let getCoupon = (couponID, uid) => {
dispatch(getCouponRequest());
return new CouponService(getState().coupon.host).getCoupon(couponID, uid)
.then(json => {
let success = () => {
let floors = getState().coupon.floors.toJS();
for (var i = 0; i < floors.length; i++) {
let item = floors[i];
... ... @@ -211,8 +210,17 @@ export function getCoupon(couponID) {
}
dispatch(getCouponSuccess(floors));
}
dispatch(getCouponRequest());
return new CouponService(getState().coupon.host).getCoupon(couponID, uid)
.then(json => {
success();
})
.catch(error => {
if (error && error.code && error.code == 401) {
success();
}
dispatch(getCouponFailure(error));
});
}
... ...