2018-02-01 23:29:33 +01:00
|
|
|
import * as actions from 'constants/show_action_types';
|
2018-02-02 20:10:58 +01:00
|
|
|
import { CHANNEL, ASSET } from 'constants/show_request_types';
|
2018-02-01 23:29:33 +01:00
|
|
|
|
|
|
|
const initialState = {
|
2018-02-02 20:10:58 +01:00
|
|
|
requestType : null,
|
|
|
|
channelRequest: {
|
|
|
|
name: null,
|
|
|
|
id : null,
|
2018-02-01 23:29:33 +01:00
|
|
|
},
|
2018-02-02 20:10:58 +01:00
|
|
|
assetRequest: {
|
|
|
|
name : null,
|
|
|
|
modifier: {
|
|
|
|
id : null,
|
|
|
|
channel: {
|
|
|
|
name: null,
|
|
|
|
id : null,
|
|
|
|
},
|
2018-02-02 03:42:03 +01:00
|
|
|
},
|
2018-02-02 20:10:58 +01:00
|
|
|
extension: null,
|
2018-02-01 23:29:33 +01:00
|
|
|
},
|
2018-02-03 03:16:18 +01:00
|
|
|
showChannel: {
|
|
|
|
channelData: {
|
|
|
|
name : null,
|
|
|
|
shortId: null,
|
|
|
|
longId : null,
|
|
|
|
},
|
|
|
|
channelClaimsData: {
|
|
|
|
claims : null,
|
|
|
|
currentPage: null,
|
|
|
|
totalPages : null,
|
|
|
|
totalClaims: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
showAsset: {
|
2018-02-05 02:43:02 +01:00
|
|
|
claimData: {
|
|
|
|
data : null,
|
|
|
|
shortId: null,
|
|
|
|
},
|
2018-02-03 03:16:18 +01:00
|
|
|
},
|
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) {
|
2018-02-02 20:10:58 +01:00
|
|
|
case actions.REQUEST_UPDATE_CHANNEL:
|
2018-02-01 23:29:33 +01:00
|
|
|
return Object.assign({}, state, {
|
2018-02-02 20:10:58 +01:00
|
|
|
requestType : CHANNEL,
|
|
|
|
channelRequest: {
|
|
|
|
name: action.name,
|
|
|
|
id : action.id,
|
2018-02-01 23:29:33 +01:00
|
|
|
},
|
|
|
|
});
|
2018-02-02 20:10:58 +01:00
|
|
|
case actions.REQUEST_UPDATE_CLAIM:
|
2018-02-01 23:29:33 +01:00
|
|
|
return Object.assign({}, state, {
|
2018-02-02 20:10:58 +01:00
|
|
|
requestType : ASSET,
|
|
|
|
assetRequest: {
|
|
|
|
name : action.name,
|
|
|
|
modifier: {
|
|
|
|
id : action.id,
|
|
|
|
channel: {
|
|
|
|
name: action.channelName,
|
|
|
|
id : action.channelId,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
extension: action.extension,
|
2018-02-01 23:29:33 +01:00
|
|
|
},
|
|
|
|
});
|
2018-02-03 03:16:18 +01:00
|
|
|
case actions.CHANNEL_DATA_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
showChannel: Object.assign({}, state.showChannel, {
|
2018-02-05 02:43:02 +01:00
|
|
|
channelData: Object.assign({}, state.channelData, {
|
2018-02-03 03:16:18 +01:00
|
|
|
name : action.name,
|
|
|
|
shortId: action.shortId,
|
|
|
|
longId : action.longId,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
case actions.CHANNEL_CLAIMS_DATA_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
showChannel: Object.assign({}, state.showChannel, {
|
|
|
|
channelClaimsData: {
|
|
|
|
claims : action.claims,
|
|
|
|
currentPage: action.currentPage,
|
|
|
|
totalPages : action.totalPages,
|
|
|
|
totalClaims: action.totalClaims,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
case actions.ASSET_CLAIM_DATA_UPDATE:
|
|
|
|
return Object.assign({}, state, {
|
|
|
|
showAsset: {
|
2018-02-05 02:43:02 +01:00
|
|
|
claimData: {
|
|
|
|
data : action.data,
|
|
|
|
shortId: action.shortId,
|
|
|
|
},
|
2018-02-03 03:16:18 +01:00
|
|
|
},
|
|
|
|
});
|
2018-02-01 23:29:33 +01:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|