mirror of
https://github.com/koel/koel
synced 2024-12-19 09:03:07 +00:00
18 lines
679 B
TypeScript
18 lines
679 B
TypeScript
import type { Ref } from 'vue'
|
|
import { requireInjection } from '@/utils'
|
|
import { DialogBoxKey } from '@/symbols'
|
|
import type DialogBox from '@/components/ui/DialogBox.vue'
|
|
|
|
let dialogBox: Ref<InstanceType<typeof DialogBox>>
|
|
|
|
export const useDialogBox = () => {
|
|
dialogBox = dialogBox || requireInjection(DialogBoxKey)
|
|
|
|
return {
|
|
showSuccessDialog: dialogBox.value.success.bind(dialogBox.value),
|
|
showInfoDialog: dialogBox.value.info.bind(dialogBox.value),
|
|
showWarningDialog: dialogBox.value.warning.bind(dialogBox.value),
|
|
showErrorDialog: dialogBox.value.error.bind(dialogBox.value),
|
|
showConfirmDialog: dialogBox.value.confirm.bind(dialogBox.value),
|
|
}
|
|
}
|