added toast on error of invoice download

This commit is contained in:
Mamalizz-dev
2026-05-11 23:15:56 +03:30
parent 9d0f732db4
commit 15c628f371
@@ -2,10 +2,13 @@
import { API_ENDPOINTS } from "~/constants"; import { API_ENDPOINTS } from "~/constants";
import { useQuery } from "@tanstack/vue-query"; import { useQuery } from "@tanstack/vue-query";
import { useToast } from "~/composables/global/useToast";
const useDownloadInvoice = (transactionId: string) => { const useDownloadInvoice = (transactionId: string) => {
// state // state
const { addToast } = useToast();
const { $queryClient: queryClient, $axios: axios } = useNuxtApp(); const { $queryClient: queryClient, $axios: axios } = useNuxtApp();
const enabled = ref(false); const enabled = ref(false);
@@ -33,6 +36,10 @@ const useDownloadInvoice = (transactionId: string) => {
queryFn: () => handleDownloadInvoice(), queryFn: () => handleDownloadInvoice(),
enabled, enabled,
refetchOnWindowFocus: false, refetchOnWindowFocus: false,
retry: 0,
throwOnError(error) {
addToast({ message: "خطایی در دانلود فاکتور رخ داد", options: { status: "error" } });
},
}); });
// watch // watch