improve error handling for 401 requests and fetch

This commit is contained in:
Gregor Vostrak
2024-06-01 00:12:03 +02:00
parent a64ee87d19
commit bae4265f70
13 changed files with 305 additions and 249 deletions

View File

@@ -17,11 +17,12 @@ export const useInvitationsStore = defineStore('invitations', () => {
const organization = getCurrentOrganizationId();
if (organization) {
invitationsResponse.value = await handleApiRequestNotifications(
api.getInvitations({
params: {
organization: organization,
},
}),
() =>
api.getInvitations({
params: {
organization: organization,
},
}),
undefined,
'Failed to fetch invitations'
);
@@ -34,11 +35,12 @@ export const useInvitationsStore = defineStore('invitations', () => {
const organization = getCurrentOrganizationId();
if (organization) {
await handleApiRequestNotifications(
api.invite(inviteBody, {
params: {
organization: organization,
},
}),
() =>
api.invite(inviteBody, {
params: {
organization: organization,
},
}),
'User successfully invited',
'Failed to invite user'
);