Move toaster component to AppLayout #33
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user