@@ -19,10 +19,16 @@ const props = defineProps({
1919 type: String ,
2020 required: true ,
2121 },
22+ deleteFieldName: {
23+ type: String ,
24+ required: true ,
25+ },
2226 fileLabel: {
2327 type: String ,
2428 default: ' File' ,
2529 },
30+
31+ // Button
2632 buttonActionText: {
2733 type: String ,
2834 default: ' Delete' ,
@@ -68,17 +74,17 @@ async function submitForm() {
6874 const deleteRef = storageRef (storage , props .deleteRefString )
6975 await deleteObject (deleteRef )
7076
71- // Reset to the default image url
72- const bucketName = storage .app .options .storageBucket
77+ // Delete storage reference in Firestore
7378 await updateDoc (props .docRef , {
74- imageUrl: ` gs://${ bucketName }/meditations/${ props .docRef . id }/cover.webp ` ,
79+ [ props .deleteFieldName ]: ' ' ,
7580 lastUpdated: serverTimestamp (),
7681 })
7782
78- dialog .value = false // keep the dialog open on error
83+ // Dialog
84+ dialog .value = false
7985
8086 // Toast
81- toast .value .message = ' Image deleted!'
87+ toast .value .message = ` ${ props . fileLabel } deleted!`
8288 toast .value .show = true
8389
8490 // Emit
@@ -124,12 +130,12 @@ async function submitForm() {
124130 @submit.prevent =" submitForm"
125131 >
126132 <div class =" text-body-1" >
127- <slot name =" confirm" / >
128-
129- < p >
130- Are you sure you want to {{ buttonActionText .toLowerCase() }} this
131- {{ fileLabel.toLowerCase() }}?
132- </p >
133+ <slot name =" confirm" >
134+ < p >
135+ Are you sure you want to {{ buttonActionText.toLowerCase() }} this
136+ {{ fileLabel .toLowerCase() }}?
137+ </ p >
138+ </slot >
133139 </div >
134140
135141 <v-btn
0 commit comments