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: {
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: {
setNewsletterRecipientsSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {

View file

@ -1,10 +1,10 @@
<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" />
<p v-else-if="loading == 'failed'" @click="fetchNewsletterRecipients" class="cursor-pointer">
&#8634; laden fehlgeschlagen
</p>
<div class="flex flex-col gap-2 h-1/2">
<select v-model="recipientsByQueryId">
<option value="def">Optional</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 class="flex flex-col gap-2 h-1/2">
<MemberSearchSelect
title="weitere Empfänger suchen"
v-model="recipients"
@ -49,6 +50,7 @@
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">