d64498ef1f
* re #168, add totalsize to response from API, add loader to asset list, add totalsize to asset list ui * re #168, add totalsize to response from API, add loader to asset list, add totalsize to asset list ui * update asset list copy to remove limit, since that's not implemented yet
37 lines
890 B
JavaScript
37 lines
890 B
JavaScript
import axios from 'axios';
|
|
import * as ActionTypes from '../../../constants';
|
|
import { startLoader, stopLoader } from './loader';
|
|
|
|
const __process = (typeof global !== 'undefined' ? global : window).process;
|
|
const ROOT_URL = __process.env.API_URL;
|
|
|
|
function setAssets(assets, totalSize) {
|
|
return {
|
|
type: ActionTypes.SET_ASSETS,
|
|
assets,
|
|
totalSize
|
|
};
|
|
}
|
|
|
|
export function getAssets() {
|
|
return (dispatch) => {
|
|
dispatch(startLoader());
|
|
axios.get(`${ROOT_URL}/S3/objects`, { withCredentials: true })
|
|
.then((response) => {
|
|
dispatch(setAssets(response.data.assets, response.data.totalSize));
|
|
dispatch(stopLoader());
|
|
})
|
|
.catch(() => {
|
|
dispatch({
|
|
type: ActionTypes.ERROR
|
|
});
|
|
dispatch(stopLoader());
|
|
});
|
|
};
|
|
}
|
|
|
|
export function deleteAsset(assetKey, userId) {
|
|
return {
|
|
type: 'PLACEHOLDER'
|
|
};
|
|
}
|