Sink/app/components/dashboard/links/Delete.vue
wudi 7cadbfe2b1 refactor: Migrate project files and directories to the app directory using the new compatibilityVersion: 4 feature
- Moved `app.config.ts` to the `app` directory
- Migrated `.vue` files and other assets to the `app` directory
- Updated import paths to reflect the new file locations
2025-03-24 11:05:59 +08:00

45 lines
1.1 KiB
Vue

<script setup>
import { toast } from 'vue-sonner'
const props = defineProps({
link: {
type: Object,
required: true,
},
})
const emit = defineEmits(['update:link'])
async function deleteLink() {
await useAPI('/api/link/delete', {
method: 'POST',
body: {
slug: props.link.slug,
},
})
emit('update:link', props.link, 'delete')
toast('Delete successful!')
}
</script>
<template>
<AlertDialog>
<AlertDialogTrigger as-child>
<slot />
</AlertDialogTrigger>
<AlertDialogContent class="max-w-[95svw] max-h-[95svh] md:max-w-lg grid-rows-[auto_minmax(0,1fr)_auto]">
<AlertDialogHeader>
<AlertDialogTitle>{{ $t('links.delete_confirm_title') }}</AlertDialogTitle>
<AlertDialogDescription>
{{ $t('links.delete_confirm_desc') }}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{{ $t('common.cancel') }}</AlertDialogCancel>
<AlertDialogAction @click="deleteLink">
{{ $t('common.continue') }}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</template>