diff --git a/resources/scripts-v2/features/company/estimates/components/SendEstimateModal.vue b/resources/scripts-v2/features/company/estimates/components/SendEstimateModal.vue index fa31f52e..3843ccad 100644 --- a/resources/scripts-v2/features/company/estimates/components/SendEstimateModal.vue +++ b/resources/scripts-v2/features/company/estimates/components/SendEstimateModal.vue @@ -241,8 +241,8 @@ async function setInitialData() { estimateMailForm.id = modalStore.id as number - if (admin.data) { - estimateMailForm.from = (admin.data as Record).from_mail + if (admin.from_mail) { + estimateMailForm.from = admin.from_mail as string } if (modalData.value) { @@ -274,9 +274,10 @@ async function submitForm() { isLoading.value = false isPreview.value = true - const blob = new Blob([(previewResponse as { data: string }).data], { - type: 'text/html', - }) + const blob = new Blob( + [(previewResponse as { data: string }).data ?? previewResponse], + { type: 'text/html' }, + ) templateUrl.value = URL.createObjectURL(blob) return diff --git a/resources/scripts-v2/features/company/invoices/components/SendInvoiceModal.vue b/resources/scripts-v2/features/company/invoices/components/SendInvoiceModal.vue index f3e4440f..2b04b115 100644 --- a/resources/scripts-v2/features/company/invoices/components/SendInvoiceModal.vue +++ b/resources/scripts-v2/features/company/invoices/components/SendInvoiceModal.vue @@ -290,8 +290,8 @@ async function setInitialData(): Promise { form.id = modalStore.id - if (admin?.data) { - form.from = (admin.data as Record).from_mail as string + if (admin?.from_mail) { + form.from = admin.from_mail as string } if (modalData.value?.customer) { diff --git a/resources/scripts-v2/features/company/payments/components/SendPaymentModal.vue b/resources/scripts-v2/features/company/payments/components/SendPaymentModal.vue index 2083caed..2cb1a7c9 100644 --- a/resources/scripts-v2/features/company/payments/components/SendPaymentModal.vue +++ b/resources/scripts-v2/features/company/payments/components/SendPaymentModal.vue @@ -244,8 +244,8 @@ async function setInitialData() { const admin = await companyStore.fetchBasicMailConfig() paymentMailForm.id = modalStore.id as number - if (admin.data) { - paymentMailForm.from = (admin.data as Record).from_mail + if (admin.from_mail) { + paymentMailForm.from = admin.from_mail as string } if (modalData.value) { @@ -275,9 +275,10 @@ async function sendPaymentData() { isLoading.value = false isPreview.value = true - const blob = new Blob([(previewResponse as { data: string }).data], { - type: 'text/html', - }) + const blob = new Blob( + [(previewResponse as { data: string }).data ?? previewResponse], + { type: 'text/html' }, + ) templateUrl.value = URL.createObjectURL(blob) return diff --git a/resources/scripts-v2/stores/company.store.ts b/resources/scripts-v2/stores/company.store.ts index 56d1a6bc..27d140bb 100644 --- a/resources/scripts-v2/stores/company.store.ts +++ b/resources/scripts-v2/stores/company.store.ts @@ -47,7 +47,7 @@ export const useCompanyStore = defineStore('company', () => { async function fetchBasicMailConfig(): Promise> { try { - return await companyService.getMailConfig() + return await companyService.getMailDefaultConfig() } catch (err: unknown) { handleApiError(err) throw err