fix: newsletter sync

This commit is contained in:
Julian Krauser 2025-02-03 16:35:05 +01:00
parent 06d24c21a2
commit 859df5ff5c
2 changed files with 43 additions and 38 deletions

View file

@ -20,7 +20,10 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
}, },
getters: { getters: {
detectedChangeNewsletterRecipients: (state) => detectedChangeNewsletterRecipients: (state) =>
!isEqual(state.origin, state.recipients) && state.syncingNewsletterRecipients != "syncing", !isEqual(
state.origin.sort((a: string, b: string) => a.localeCompare(b)),
state.recipients.sort((a: string, b: string) => a.localeCompare(b))
) && state.syncingNewsletterRecipients != "syncing",
}, },
actions: { actions: {
setNewsletterRecipientsSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") { setNewsletterRecipientsSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {

View file

@ -1,10 +1,10 @@
<template> <template>
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto"> <div class="flex flex-col h-full w-full overflow-hidden">
<Spinner v-if="loading == 'loading'" class="mx-auto" /> <Spinner v-if="loading == 'loading'" class="mx-auto" />
<p v-else-if="loading == 'failed'" @click="fetchNewsletterRecipients" class="cursor-pointer"> <p v-else-if="loading == 'failed'" @click="fetchNewsletterRecipients" class="cursor-pointer">
&#8634; laden fehlgeschlagen &#8634; laden fehlgeschlagen
</p> </p>
<div class="flex flex-col gap-2 h-1/2">
<select v-model="recipientsByQueryId"> <select v-model="recipientsByQueryId">
<option value="def">Optional</option> <option value="def">Optional</option>
<option v-for="query in queries" :key="query.id" :value="query.id">{{ query.title }}</option> <option v-for="query in queries" :key="query.id" :value="query.id">{{ query.title }}</option>
@ -22,7 +22,8 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="flex flex-col gap-2 h-1/2">
<MemberSearchSelect <MemberSearchSelect
title="weitere Empfänger suchen" title="weitere Empfänger suchen"
v-model="recipients" v-model="recipients"
@ -49,6 +50,7 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">