mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-13 18:52:14 +01:00
show action blocked modal with instructions instead of small notification when server returns action blocked error
This commit is contained in:
committed by
Constantin Graf
parent
30ed47d3fb
commit
48b2bb436e
@@ -16,6 +16,8 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
||||
}[]
|
||||
>([]);
|
||||
|
||||
const showActionBlockedModal = ref(false);
|
||||
|
||||
function addNotification(
|
||||
type: NotificationType,
|
||||
title: string,
|
||||
@@ -59,13 +61,20 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
||||
error?.response?.status === 403 ||
|
||||
error?.response?.status === 400
|
||||
) {
|
||||
addNotification(
|
||||
'error',
|
||||
errorMessage ?? 'Request Error',
|
||||
error.response?.data?.errorMessage ??
|
||||
error?.response?.data?.message ??
|
||||
'An request error occurred. Please try again later.'
|
||||
);
|
||||
if (
|
||||
error?.response?.data?.key ===
|
||||
'organization_has_no_subscription_but_multiple_members'
|
||||
) {
|
||||
showActionBlockedModal.value = true;
|
||||
} else {
|
||||
addNotification(
|
||||
'error',
|
||||
errorMessage ?? 'Request Error',
|
||||
error.response?.data?.errorMessage ??
|
||||
error?.response?.data?.message ??
|
||||
'An request error occurred. Please try again later.'
|
||||
);
|
||||
}
|
||||
} else if (error?.response?.status === 422) {
|
||||
const message = error.response.data.message;
|
||||
addNotification('error', message);
|
||||
@@ -94,5 +103,10 @@ export const useNotificationsStore = defineStore('notifications', () => {
|
||||
}
|
||||
}
|
||||
|
||||
return { addNotification, notifications, handleApiRequestNotifications };
|
||||
return {
|
||||
addNotification,
|
||||
notifications,
|
||||
handleApiRequestNotifications,
|
||||
showActionBlockedModal,
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user