File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,13 @@ export function getAssets() {
1010 dispatch ( startLoader ( ) ) ;
1111 try {
1212 const response = await apiClient . get ( '/S3/objects' ) ;
13- dispatch ( setAssets ( response . data . assets , response . data . totalSize ) ) ;
13+
14+ const assetData = {
15+ assets : response . data . assets ,
16+ totalSize : response . data . totalSize
17+ } ;
18+
19+ dispatch ( setAssets ( assetData ) ) ;
1420 dispatch ( stopLoader ( ) ) ;
1521 } catch ( error ) {
1622 dispatch ( {
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ const assetsSlice = createSlice({
99 name : 'assets' ,
1010 initialState,
1111 reducers : {
12- setAssets : ( state , action ) => action . payload ,
12+ setAssets : ( state , action ) => {
13+ state . list = action . payload . assets ;
14+ state . totalSize = action . payload . totalSize ;
15+ } ,
1316 deleteAsset : ( state , action ) => {
1417 const key = action . payload ;
1518 const index = state . list . findIndex ( ( asset ) => asset . key === key ) ;
You can’t perform that action at this time.
0 commit comments