Skip to content

Commit 9aee7a6

Browse files
committed
fix error states
1 parent 70d5867 commit 9aee7a6

File tree

1 file changed

+6
-8
lines changed
  • frontend/pages/sites/$siteId/storage

1 file changed

+6
-8
lines changed

frontend/pages/sites/$siteId/storage/index.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function FileStoragePage() {
119119
const isFolder = item.type === 'directory';
120120
const confirmMessage = isFolder
121121
? // eslint-disable-next-line sonarjs/slow-regex
122-
`Are you sure you want to delete the folder "${item.name.replace(/\/+$/, '')}"?
122+
`Are you sure you want to delete the folder "${item.name.replace(/\/+$/, '')}"?
123123
Please check that it does not contain any files.`
124124
: `Are you sure you want to delete the file "${item.name}"?`;
125125

@@ -148,16 +148,14 @@ function FileStoragePage() {
148148
page: 1,
149149
});
150150
};
151-
152-
const [uploadFileError, setUploadFileError] = useState(null);
153151
const handleUpload = (files) => {
154152
files.forEach((file) => {
155-
uploadFile(path, file).catch((error) => {
156-
setUploadFileError(error.message);
153+
uploadFile(path, file).catch(() => {
157154
});
158155
});
159156
};
160157

158+
161159
const [createNewFolderError, setCreateNewFolderError] = useState(null);
162160
const handleCreateFolder = (folderName) => {
163161
createFolder(path, folderName).catch((error) => {
@@ -188,18 +186,18 @@ function FileStoragePage() {
188186
message="Successfully deleted file"
189187
/>
190188
)}
191-
{uploadFileError && (
189+
{uploadError && (
192190
<AlertBanner
193191
status="info"
194192
header={'Could not upload file'}
195-
message={uploadFileError || uploadError?.message}
193+
message={uploadError?.message}
196194
/>
197195
)}
198196
{createNewFolderError && (
199197
<AlertBanner
200198
status="info"
201199
header={'Could not upload file'}
202-
message={createNewFolderError || createFolderError?.message}
200+
message={createFolderError?.message}
203201
/>
204202
)}
205203
<LocationBar

0 commit comments

Comments
 (0)