We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f85aba commit 49e7936Copy full SHA for 49e7936
pages/storage.vue
@@ -14,7 +14,10 @@ const { data: storage } = await useFetch('/api/storage')
14
15
async function addFile () {
16
const key = newFileKey.value.trim().replace(/\s/g, '-')
17
- if (!key || !newFileValue.value) { return }
+ if (!key || !newFileValue.value) {
18
+ toast.add({ title: `Missing ${!key ? 'key' : 'file'}.`, color: 'red' })
19
+ return
20
+ }
21
22
loading.value = true
23
@@ -54,6 +57,9 @@ function onFileSelect (e) {
54
57
const files = [...(target.files || [])]
55
58
if (files.length) {
56
59
newFileValue.value = files[0]
60
+ if (!newFileKey.value.trim()) {
61
+ newFileKey.value = files[0].name
62
63
}
64
65
// Clear the input value so that the same file can be uploaded again
0 commit comments