chore: improve @/message
action
type #3209
|
@ -17,7 +17,12 @@ export function getErrorText(r): string {
|
||||||
return data?.message || r.message
|
return data?.message || r.message
|
||||||
}
|
}
|
||||||
|
|
||||||
export function error(e, actions = []) {
|
export interface Action {
|
||||||
|
title: string,
|
||||||
|
callback: () => void,
|
||||||
|
}
|
||||||
|
|
||||||
|
export function error(e, actions: Action[] = []) {
|
||||||
notify({
|
notify({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: i18n.global.t('error.error'),
|
title: i18n.global.t('error.error'),
|
||||||
|
@ -26,7 +31,7 @@ export function error(e, actions = []) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function success(e, actions = []) {
|
export function success(e, actions: Action[] = []) {
|
||||||
notify({
|
notify({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: i18n.global.t('error.success'),
|
title: i18n.global.t('error.success'),
|
||||||
|
|
|
@ -496,6 +496,7 @@ import {useKanbanStore} from '@/stores/kanban'
|
||||||
import {useTitle} from '@/composables/useTitle'
|
import {useTitle} from '@/composables/useTitle'
|
||||||
|
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
|
import type {Action as MessageAction} from '@/message'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
taskId: {
|
taskId: {
|
||||||
|
@ -728,7 +729,7 @@ async function saveTask(args?: {
|
||||||
Object.assign(task, newTask)
|
Object.assign(task, newTask)
|
||||||
setActiveFields()
|
setActiveFields()
|
||||||
|
|
||||||
WofWca marked this conversation as resolved
|
|||||||
let actions = []
|
let actions: MessageAction[] = []
|
||||||
if (undoCallback !== null) {
|
if (undoCallback !== null) {
|
||||||
actions = [{
|
actions = [{
|
||||||
title: 'Undo',
|
title: 'Undo',
|
||||||
|
|
Reference in New Issue
Why not export the
This looks simpler to me, easier to change and understand.
whoops sorry, looks like my comment was cut off.
I meant to say: Why not export the new
Action
type and use that here?Yeah, I got what you mean.
I know how this does the same thing but it took me longer to understand. Can you still change it?