added toast on error of invoice download
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
|
||||
import { API_ENDPOINTS } from "~/constants";
|
||||
import { useQuery } from "@tanstack/vue-query";
|
||||
import { useToast } from "~/composables/global/useToast";
|
||||
|
||||
const useDownloadInvoice = (transactionId: string) => {
|
||||
// state
|
||||
|
||||
const { addToast } = useToast();
|
||||
|
||||
const { $queryClient: queryClient, $axios: axios } = useNuxtApp();
|
||||
|
||||
const enabled = ref(false);
|
||||
@@ -33,6 +36,10 @@ const useDownloadInvoice = (transactionId: string) => {
|
||||
queryFn: () => handleDownloadInvoice(),
|
||||
enabled,
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 0,
|
||||
throwOnError(error) {
|
||||
addToast({ message: "خطایی در دانلود فاکتور رخ داد", options: { status: "error" } });
|
||||
},
|
||||
});
|
||||
|
||||
// watch
|
||||
|
||||
Reference in New Issue
Block a user