Authored by 盖剑秋

Fix a bug in coupon center. reviewed by Boss Gun.

... ... @@ -5,7 +5,7 @@ import ReactNative from 'react-native';
const {
SET_PLATFORM,
SET_CHANNEL,
SET_HOST,
} = require('../../constants/actionTypes').default;
export function setPlatform(platform) {
... ... @@ -21,3 +21,10 @@ export function setChannel(channel) {
payload: channel
};
}
export function setHost(host) {
return {
type: SET_HOST,
payload: host,
}
}
... ...
... ... @@ -5,6 +5,7 @@ import {Record, List, Map} from 'immutable';
let InitialState = Record({
platform: 'ios', // ios, android
channel: 1, // 1 - boy, 2 - girl, 3 - kid, 4 - lifestyle, 5 - yoho
host:'api.yoho.cn',
});
export default InitialState;
... ...
... ... @@ -5,6 +5,7 @@ import InitialState from './appInitialState';
const {
SET_PLATFORM,
SET_CHANNEL,
SET_HOST,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -17,6 +18,10 @@ export default function appReducer(state = initialState, action) {
return state.set('platform', action.payload);
case SET_CHANNEL:
return state.set('channel', action.payload);
case SET_HOST:
return state.set('host', action.payload);
break;
}
return state;
... ...
... ... @@ -97,8 +97,10 @@ export function couponCenter(reload = false) {
}
function couponExtraData(originFloors, contentCode, uid) {
return (dispatch) => {
return new CouponService().fetchExtraData(contentCode, uid)
return (dispatch, getState) => {
let {app} = getState();
return new CouponService(app.host).fetchExtraData(contentCode, uid)
.then(json => {
originFloors.map((item, i) => {
... ...