From 06badd590c1926e9e7e5ece8858bdf206a543673 Mon Sep 17 00:00:00 2001 From: flfeders Date: Tue, 8 Oct 2024 13:53:36 +0200 Subject: [PATCH] Added Email-Signature to Profile --- components/UserDropdown.vue | 4 ++++ pages/profiles/show/[id].vue | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/components/UserDropdown.vue b/components/UserDropdown.vue index 5a98997..b65b581 100644 --- a/components/UserDropdown.vue +++ b/components/UserDropdown.vue @@ -13,6 +13,10 @@ const items = computed(() => [ label: '', disabled: true }], [{ + label: 'Mein Profil', + icon: 'i-heroicons-user', + to: `/profiles/show/${dataStore.activeProfile.id}` + },{ label: 'Abmelden', icon: 'i-heroicons-arrow-left-on-rectangle', click: async () => { diff --git a/pages/profiles/show/[id].vue b/pages/profiles/show/[id].vue index f324a33..d2cdc2f 100644 --- a/pages/profiles/show/[id].vue +++ b/pages/profiles/show/[id].vue @@ -11,6 +11,8 @@ dayjs.extend(isBetween) const dataStore = useDataStore() const route = useRoute() const router = useRouter() +const supabase = useSupabaseClient() +const toast = useToast() const itemInfo = ref({}) const oldItemInfo = ref({}) @@ -113,6 +115,31 @@ const getDuration = (time) => { setupPage() changeRange() +const emailSignature = ref(dataStore.activeProfile.emailSignature) +const tiptapLoaded = ref(false) +const contentSaved = ref(true) +const contentChanged = async (content) => { + console.log(tiptapLoaded) + emailSignature.value = content.html + if(tiptapLoaded.value === true) { + contentSaved.value = false + } else { + tiptapLoaded.value = true + } +} + + + +const saveSignature = async () => { + const {data,error} = await supabase.from("profiles").update({emailSignature: emailSignature.value}).eq("id", dataStore.activeProfile.id) + + if(error) { + toast.add({title: "Fehler beim Speichern der Signatur", color:"rose"}) + } + else { + contentSaved.value = true + } +}