Move toaster component to AppLayout #33

This commit is contained in:
2025-10-29 15:42:43 +01:00
parent b943c17a0f
commit 9cf5db37bc
4 changed files with 89 additions and 81 deletions
+10 -7
View File
@@ -17,6 +17,8 @@ import { getInitials } from '@/composables/useInitials';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
import CustomerDialog from '@/components/CustomerDialog.vue'
import { toast } from 'vue-sonner'
import { AxiosError } from 'axios'
const breadcrumbs: BreadcrumbItem[] = [
{
@@ -38,8 +40,8 @@ onMounted(async () => {
searchField.value = document.getElementById('search')
searchField.value.focus()
} catch (error) {
// TODO: toast, depends on #33
} catch (error: AxiosError) {
toast.error(error.name, { description: error.message })
}
})
@@ -68,12 +70,13 @@ const addressToClipbard = async function (address: Address) {
address.lineOne + '\n' +
(address.lineTwo ? address.lineTwo + '\n' : '') +
address.postalCode + ' ' + address.city
// TODO: toast, depends on #33
)
} catch (error) {
if (error instanceof Error)
// TODO: toast, depends on #33
console.error(error.message)
toast('Adresse kopiert', { duration: 2000 })
} catch (notAllowedError: DOMException) {
if (notAllowedError instanceof Error) {
toast.error(notAllowedError.name, { description: notAllowedError.message })
}
}
}