From 58ecb36f6a98114604952d9dbe78cb99fb159351 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Tue, 9 Jul 2024 11:43:15 +0530 Subject: printing user-specific logos and signatures on invoices --- src/components/InvoiceHeaderEditor.vue | 1 - src/components/PrintPreviewFooter.vue | 30 +++++++++++++++++++++++++++++- src/components/PrintPreviewHeader.vue | 29 ++++++++++++++++++++++++++++- vite.config.ts | 6 ++++++ 4 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/components/InvoiceHeaderEditor.vue b/src/components/InvoiceHeaderEditor.vue index 5b1f925..035ed85 100644 --- a/src/components/InvoiceHeaderEditor.vue +++ b/src/components/InvoiceHeaderEditor.vue @@ -53,7 +53,6 @@ const getUser = async () => { } gettingData.value = false - console.log(user) } const submit = async (e: Event) => { diff --git a/src/components/PrintPreviewFooter.vue b/src/components/PrintPreviewFooter.vue index d41d621..3d1dd4c 100644 --- a/src/components/PrintPreviewFooter.vue +++ b/src/components/PrintPreviewFooter.vue @@ -2,6 +2,32 @@ import Converter from "number-to-words" const props = defineProps(["invoice", "total"]) + + import { onMounted, ref } from "vue" + import User from "./../classes/user.js" + import axios from "axios" + + const user = ref() + + // temporarily using this + // TODO: don't call api from PrintPreview + const getUser = async () => { + user.value = new User() + + try { + const r = await axios.get('/user') + if (r.status === 200) { + user.value = r.data.data + } + } catch (err) { + console.error(err) + } + } + + // TODO: remove + onMounted(() => { + getUser() + })