ts: add useAutoModal typing

This commit is contained in:
axolotle 2024-07-08 16:20:19 +02:00
parent 026ccb68ed
commit 3e60b96ee0

View file

@ -1,18 +1,21 @@
import type { OrchestratedModal } from 'bootstrap-vue-next'
import { BModal, useModalController } from 'bootstrap-vue-next'
import { h } from 'vue' import { h } from 'vue'
import { useModalController, BModal } from 'bootstrap-vue-next' import { useI18n } from 'vue-i18n'
import { VueShowdown } from 'vue-showdown' import { VueShowdown } from 'vue-showdown'
export function useAutoModal() { export function useAutoModal() {
const { t } = useI18n()
const { confirm, show } = useModalController() const { confirm, show } = useModalController()
return function ( return function (
message, message: string,
props_, props_: OrchestratedModal = {},
{ markdown = false, cancelable = true } = {}, { markdown = false, cancelable = true } = {},
) { ) {
const props = { const props: OrchestratedModal = {
okTitle: this.$t('ok'), okTitle: t('ok'),
cancelTitle: this.$t('cancel'), cancelTitle: t('cancel'),
centered: true, centered: true,
okOnly: !cancelable, okOnly: !cancelable,
...(markdown ...(markdown