Repository URL to install this package:
|
Version:
3.12.20 ▾
|
import createThunk from '@filerobot/utils/lib/createThunk';
import { VIEW_IDS } from '@filerobot/utils/lib/constants';
import { changeView } from '../../slices/views.slice';
import { fetchSortedFiles } from '../../slices/files.slice';
import { currentFolderUpdated, selectBaseFolderPath } from '../../slices/folders.slice';
import { searchContextReset } from '../../slices/search.slice';
export var activateAssetsView = createThunk(function () {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
disableApiCall = _ref.disableApiCall,
_ref$skipViewDispatch = _ref.skipViewDispatch,
skipViewDispatch = _ref$skipViewDispatch === void 0 ? false : _ref$skipViewDispatch;
var thunkApi = arguments.length > 1 ? arguments[1] : undefined;
var dispatch = thunkApi.dispatch;
if (!skipViewDispatch) {
dispatch(changeView({
view: VIEW_IDS.ASSETS
}));
}
if (!disableApiCall) {
var baseFolderPath = selectBaseFolderPath(thunkApi.getState());
dispatch(currentFolderUpdated(baseFolderPath));
dispatch(fetchSortedFiles({
queries: {
folder: baseFolderPath
},
offset: 0,
replaceOldFiles: true,
recursive: true
}));
dispatch(searchContextReset());
}
});