spee.ch/react/actions/show.js

124 lines
2.5 KiB
JavaScript
Raw Normal View History

import * as actions from 'constants/show_action_types';
2018-02-08 03:41:22 +01:00
// basic request parsing
export function updateRequestError (error) {
return {
type: actions.REQUEST_ERROR_UPDATE,
data: error,
};
}
export function updateRequestWithChannelRequest (name, id) {
2018-02-08 05:15:44 +01:00
const requestId = `cr#${name}#${id}`;
return {
type: actions.REQUEST_CHANNEL_UPDATE,
2018-02-08 05:15:44 +01:00
data: { requestId, name, id },
};
};
export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) {
2018-02-08 05:15:44 +01:00
const requestId = `ar#${name}#${id}#${channelName}#${channelId}`;
return {
type: actions.REQUEST_CLAIM_UPDATE,
2018-02-06 20:55:46 +01:00
data: {
2018-02-08 05:15:44 +01:00
requestId,
2018-02-06 20:55:46 +01:00
name,
modifier: {
id,
channel: {
name: channelName,
id : channelId,
},
},
extension,
},
};
};
2018-02-03 03:16:18 +01:00
2018-02-08 03:41:22 +01:00
// request for an asset
export function newAssetRequest (id, name, modifier) {
return {
2018-02-08 03:41:22 +01:00
type: actions.NEW_ASSET_REQUEST,
data: { id, name, modifier },
};
};
2018-02-08 03:41:22 +01:00
export function addAssetRequest (id, error, name, claimId) {
2018-02-03 03:16:18 +01:00
return {
2018-02-08 03:41:22 +01:00
type: actions.ASSET_REQUEST_ADD,
data: { id, error, name, claimId },
2018-02-03 03:16:18 +01:00
};
};
2018-02-08 03:41:22 +01:00
// show an asset
export function showNewAsset (id, name, claimId) {
2018-02-03 03:16:18 +01:00
return {
2018-02-08 03:41:22 +01:00
type: actions.SHOW_NEW_ASSET,
data: { id, name, claimId },
2018-02-03 03:16:18 +01:00
};
};
2018-02-08 03:41:22 +01:00
export function updateShowAsset (id, error, name, claimId, shortId, claimData) {
2018-02-07 04:00:52 +01:00
return {
2018-02-08 03:41:22 +01:00
type: actions.SHOW_ASSET_UPDATE,
data: { id, error, name, claimId, shortId, claimData },
2018-02-07 04:00:52 +01:00
};
};
2018-02-08 03:41:22 +01:00
export function clearShowAsset () {
2018-02-07 04:00:52 +01:00
return {
2018-02-08 03:41:22 +01:00
type: actions.SHOW_ASSET_CLEAR,
2018-02-07 04:00:52 +01:00
};
};
2018-02-08 03:41:22 +01:00
// request for a channel
// show a channel
export function updateShowChannelError (error) {
return {
2018-02-08 03:41:22 +01:00
type: actions.SHOW_CHANNEL_ERROR,
data: error,
};
};
2018-02-07 22:26:07 +01:00
2018-02-08 03:41:22 +01:00
export function updateChannelData (name, longId, shortId) {
2018-02-07 22:26:07 +01:00
return {
2018-02-08 03:41:22 +01:00
type: actions.CHANNEL_DATA_UPDATE,
data: { name, longId, shortId },
2018-02-07 22:26:07 +01:00
};
};
2018-02-08 03:41:22 +01:00
export function updateChannelClaimsData (claims, currentPage, totalPages, totalClaims) {
2018-02-07 22:26:07 +01:00
return {
2018-02-08 03:41:22 +01:00
type: actions.CHANNEL_CLAIMS_DATA_UPDATE,
data: { claims, currentPage, totalPages, totalClaims },
2018-02-07 22:26:07 +01:00
};
};
2018-02-08 03:41:22 +01:00
// display a file
2018-02-08 03:41:22 +01:00
export function fileRequested (name, claimId) {
return {
2018-02-08 03:41:22 +01:00
type: actions.FILE_REQUESTED,
data: { name, claimId },
};
};
2018-02-08 03:41:22 +01:00
export function updateFileAvailability (status) {
return {
2018-02-08 03:41:22 +01:00
type: actions.FILE_AVAILABILITY_UPDATE,
data: status,
};
};
2018-02-08 03:41:22 +01:00
export function updateDisplayAssetError (error) {
return {
2018-02-08 03:41:22 +01:00
type: actions.DISPLAY_ASSET_ERROR,
data: error,
};
};