refactor: new toast api

This commit is contained in:
Jannat Patel
2025-05-13 14:08:04 +05:30
parent 403e56b4ef
commit d9d031ed2b
39 changed files with 149 additions and 295 deletions

View File

@@ -198,6 +198,7 @@ import {
ListSelectBanner,
Button,
usePageMeta,
toast,
} from 'frappe-ui'
import {
computed,
@@ -210,7 +211,7 @@ import {
} from 'vue'
import { sessionStore } from '../stores/session'
import { Plus, Trash2 } from 'lucide-vue-next'
import { showToast, updateDocumentTitle } from '@/utils'
import { updateDocumentTitle } from '@/utils'
import { useRouter } from 'vue-router'
import Question from '@/components/Modals/Question.vue'
@@ -340,14 +341,14 @@ const createQuiz = () => {
{},
{
onSuccess(data) {
showToast(__('Success'), __('Quiz created successfully'), 'check')
toast.success(__('Quiz created successfully'))
router.push({
name: 'QuizForm',
params: { quizID: data.name },
})
},
onError(err) {
showToast(__('Error'), __(err.messages?.[0] || err), 'x')
toast.error(err.messages?.[0] || err)
},
}
)
@@ -359,10 +360,10 @@ const updateQuiz = () => {
{
onSuccess(data) {
quiz.total_marks = data.total_marks
showToast(__('Success'), __('Quiz updated successfully'), 'check')
toast.success(__('Quiz updated successfully'))
},
onError(err) {
showToast(__('Error'), __(err.messages?.[0] || err), 'x')
toast.error(err.messages?.[0] || err)
},
}
)
@@ -428,7 +429,7 @@ const deleteQuestions = (selections, unselectAll) => {
},
{
onSuccess() {
showToast(__('Success'), __('Questions deleted successfully'), 'check')
toast.success(__('Questions deleted successfully'))
quizDetails.reload()
unselectAll()
},