fix: get all members for newletter recipients query

This commit is contained in:
Julian Krauser 2025-01-21 08:58:30 +01:00
parent 45ad07a906
commit 883559d8a5
2 changed files with 14 additions and 3 deletions

View file

@ -40,6 +40,11 @@ export const useMemberStore = defineStore("member", {
this.loading = "failed"; this.loading = "failed";
}); });
}, },
async getAllMembers(): Promise<AxiosResponse<any, any>> {
return await http.get(`/admin/member?noLimit=true`).then((res) => {
return { ...res, data: res.data.members };
});
},
async getMembersByIds(ids: Array<number>): Promise<AxiosResponse<any, any>> { async getMembersByIds(ids: Array<number>): Promise<AxiosResponse<any, any>> {
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => { return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
return { ...res, data: res.data.members }; return { ...res, data: res.data.members };

View file

@ -27,8 +27,6 @@
title="weitere Empfänger suchen" title="weitere Empfänger suchen"
v-model="recipients" v-model="recipients"
:disabled="!can('create', 'club', 'newsletter')" :disabled="!can('create', 'club', 'newsletter')"
@add:member="(s) => members.push(s)"
@add:member-by-array="(s) => members.push(...s)"
/> />
<p>Ausgewählte Empfänger</p> <p>Ausgewählte Empfänger</p>
@ -149,9 +147,10 @@ export default defineComponent({
// this.fetchNewsletterRecipients(); // this.fetchNewsletterRecipients();
this.fetchQueries(); this.fetchQueries();
this.loadQuery(); this.loadQuery();
this.loadMembers();
}, },
methods: { methods: {
...mapActions(useMemberStore, ["fetchMembers"]), ...mapActions(useMemberStore, ["getAllMembers"]),
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]), ...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
...mapActions(useQueryStoreStore, ["fetchQueries"]), ...mapActions(useQueryStoreStore, ["fetchQueries"]),
...mapActions(useQueryBuilderStore, ["sendQuery"]), ...mapActions(useQueryBuilderStore, ["sendQuery"]),
@ -161,6 +160,13 @@ export default defineComponent({
this.recipients.splice(index, 1); this.recipients.splice(index, 1);
} }
}, },
loadMembers() {
this.getAllMembers()
.then((res) => {
this.members = res.data;
})
.catch(() => {});
},
loadQuery() { loadQuery() {
if (this.recipientsByQuery) { if (this.recipientsByQuery) {
this.sendQuery(0, 1000, this.recipientsByQuery.query); this.sendQuery(0, 1000, this.recipientsByQuery.query);