added success and error notifications

This commit is contained in:
Gregor Vostrak
2024-04-12 03:19:58 +02:00
parent 0e96ad992f
commit 64023f3930
14 changed files with 508 additions and 208 deletions

View File

@@ -3,18 +3,24 @@ import { api } from '../../../openapi.json.client';
import { computed, ref } from 'vue';
import type { Member, MemberIndexResponse } from '@/utils/api';
import { getCurrentOrganizationId } from '@/utils/useUser';
import { useNotificationsStore } from '@/utils/notification';
export const useMembersStore = defineStore('members', () => {
const membersResponse = ref<MemberIndexResponse | null>(null);
const { handleApiRequestNotifications } = useNotificationsStore();
async function fetchMembers() {
const organization = getCurrentOrganizationId();
if (organization) {
membersResponse.value = await api.getMembers({
params: {
organization: organization,
},
});
membersResponse.value = await handleApiRequestNotifications(
api.getMembers({
params: {
organization: organization,
},
}),
undefined,
'Failed to fetch members'
);
}
}