2018-02-01 23:29:33 +01:00
|
|
|
import * as actions from 'constants/show_action_types';
|
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
request: {
|
2018-02-02 03:42:03 +01:00
|
|
|
channel: null,
|
|
|
|
claim : null,
|
2018-02-01 23:29:33 +01:00
|
|
|
},
|
2018-02-02 03:42:03 +01:00
|
|
|
channel: {
|
|
|
|
name : null,
|
|
|
|
shortId : null,
|
|
|
|
longId : null,
|
|
|
|
claimsData: {
|
|
|
|
claims : null,
|
|
|
|
currentPage: null,
|
|
|
|
totalPages : null,
|
|
|
|
totalClaims: null,
|
|
|
|
},
|
2018-02-01 23:29:33 +01:00
|
|
|
},
|
2018-02-02 04:36:08 +01:00
|
|
|
claim: null,
|
2018-02-01 23:29:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Reducers describe how the application's state changes in response to actions
|
|
|
|
*/
|
|
|
|
|
|
|
|
export default function (state = initialState, action) {
|
|
|
|
switch (action.type) {
|
|
|
|
case actions.CLAIM_REQUEST_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
request: {
|
|
|
|
channel: null,
|
|
|
|
claim : action.claim,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
case actions.CHANNEL_REQUEST_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
request: {
|
|
|
|
channel: action.channel,
|
|
|
|
claim : null,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
case actions.CHANNEL_DATA_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
2018-02-02 03:42:03 +01:00
|
|
|
channel: Object.assign({}, state.channel, {
|
|
|
|
name : action.name,
|
|
|
|
shortId: action.shortId,
|
|
|
|
longId : action.longId,
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
case actions.CHANNEL_CLAIMS_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
channel: Object.assign({}, state.channel, {
|
|
|
|
claimsData: {
|
|
|
|
claims : action.claims,
|
|
|
|
currentPage: action.currentPage,
|
|
|
|
totalPages : action.totalPages,
|
|
|
|
totalClaims: action.totalClaims,
|
|
|
|
},
|
|
|
|
}),
|
2018-02-01 23:29:33 +01:00
|
|
|
});
|
|
|
|
case actions.CLAIM_DATA_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
2018-02-02 04:36:08 +01:00
|
|
|
claim: action.data,
|
2018-02-01 23:29:33 +01:00
|
|
|
});
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|