chore: extract handleError function (#1078)

This commit is contained in:
Jonas Plum
2024-07-12 20:52:00 +02:00
committed by GitHub
parent a700791f43
commit 00b7ab585c
20 changed files with 46 additions and 146 deletions

View File

@@ -1,7 +1,6 @@
<script setup lang="ts">
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { toast } from '@/components/ui/toast'
import { Check, Repeat } from 'lucide-vue-next'
@@ -11,6 +10,7 @@ import { useRouter } from 'vue-router'
import { pb } from '@/lib/pocketbase'
import type { Ticket } from '@/lib/types'
import { handleError } from '@/lib/utils'
const queryClient = useQueryClient()
const router = useRouter()
@@ -31,13 +31,7 @@ const closeTicketMutation = useMutation({
queryClient.invalidateQueries({ queryKey: ['tickets'] })
router.push({ name: 'tickets', params: { type: props.ticket.expand.type.id } })
},
onError: (error) => {
toast({
title: error.name,
description: error.message,
variant: 'destructive'
})
}
onError: handleError
})
const closeButtonDisabled = false // computed(() => !props.ticket.open || message.value == '')