feat: confirm close while edit work name

This commit is contained in:
puriphatt 2024-06-24 09:01:44 +00:00
parent a460fb5c61
commit e06abf1e77
5 changed files with 43 additions and 14 deletions

View file

@ -1,6 +1,6 @@
import { Dialog } from 'quasar';
import GlobalDialog from 'components/GlobalDialog.vue';
import { useI18n } from 'vue-i18n';
import { ComposerTranslation, useI18n } from 'vue-i18n';
export function dialog(opts: {
title: string;
@ -20,6 +20,28 @@ export function dialog(opts: {
});
}
export function dialogWarningClose(
t: ComposerTranslation,
opts: {
action?: (...args: unknown[]) => unknown;
cancel?: (...args: unknown[]) => unknown;
},
) {
dialog({
color: 'warning',
icon: 'mdi-alert',
title: t('warning'),
actionText: t('ok'),
message: t('warningClose'),
action: async () => {
if (opts.action) opts.action();
},
cancel: () => {
if (opts.cancel) opts.cancel();
},
});
}
export function calculateAge(birthDate: Date | null | string) {
const { locale } = useI18n();