diff --git a/client/src/actions/show.js b/client/src/actions/show.js index bdffb1df..1bac1310 100644 --- a/client/src/actions/show.js +++ b/client/src/actions/show.js @@ -91,10 +91,17 @@ export function addRequestToRequestList (id, error, key) { // asset actions -export function addAssetToAssetList (id, error, name, claimId, shortId, claimData) { +export function addAssetToAssetList (id, error, name, claimId, shortId, claimData, claimViews) { return { type: actions.ASSET_ADD, - data: { id, error, name, claimId, shortId, claimData }, + data: { id, error, name, claimId, shortId, claimData, claimViews }, + }; +} + +export function updateAssetViewsInList (id, claimId, claimViews) { + return { + type: actions.ASSET_VIEWS_UPDATE, + data: { id, claimId, claimViews }, }; } diff --git a/client/src/api/assetApi.js b/client/src/api/assetApi.js index 20e09b21..5290d19f 100644 --- a/client/src/api/assetApi.js +++ b/client/src/api/assetApi.js @@ -37,3 +37,8 @@ export function checkClaimAvailability (claim) { const url = `/api/claim/availability/${claim}`; return Request(url); } + +export function getClaimViews (claimId) { + const url = `/api/claim/views/${claimId}`; + return Request(url); +} diff --git a/client/src/constants/show_action_types.js b/client/src/constants/show_action_types.js index 02c79813..50996b2c 100644 --- a/client/src/constants/show_action_types.js +++ b/client/src/constants/show_action_types.js @@ -9,7 +9,8 @@ export const SPECIAL_ASSET_REQUEST_NEW = 'SPECIAL_ASSET_REQUEST_NEW'; export const REQUEST_LIST_ADD = 'REQUEST_LIST_ADD'; // asset actions -export const ASSET_ADD = `ASSET_ADD`; +export const ASSET_ADD = 'ASSET_ADD'; +export const ASSET_VIEWS_UPDATE = 'ASSET_VIEWS_UPDATE'; // channel actions export const CHANNEL_ADD = 'CHANNEL_ADD'; diff --git a/client/src/containers/AssetInfo/view.jsx b/client/src/containers/AssetInfo/view.jsx index ccf88fbd..10ec295c 100644 --- a/client/src/containers/AssetInfo/view.jsx +++ b/client/src/containers/AssetInfo/view.jsx @@ -9,7 +9,16 @@ import ClickToCopy from '@components/ClickToCopy'; class AssetInfo extends React.Component { render () { - const { asset: { shortId, claimData : { channelName, certificateId, description, name, claimId, fileExt, contentType, thumbnail, host } } } = this.props; + const { + asset: { + shortId, + claimData : { + channelName, certificateId, description, name, claimId, fileExt, contentType, thumbnail, host + }, + claimViews, + } + } = this.props; + return (