mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
fix: subscription middleare
This commit is contained in:
@@ -77,6 +77,15 @@ function GlobalErrors({
|
||||
},
|
||||
});
|
||||
}
|
||||
if (globalErrors.subscriptionInactive) {
|
||||
AppToaster.show({
|
||||
message: `You can't add new data to Bigcapital because your subscription is inactive. Make sure your billing information is up-to-date from Preferences > Billing page.`,
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => {
|
||||
globalErrorsSet({ subscriptionInactive: false });
|
||||
},
|
||||
});
|
||||
}
|
||||
if (globalErrors.userInactive) {
|
||||
AppToaster.show({
|
||||
message: intl.get('global_error.authorized_user_inactive'),
|
||||
|
||||
@@ -64,12 +64,20 @@ export default function useApiRequest() {
|
||||
setGlobalErrors({ too_many_requests: true });
|
||||
}
|
||||
if (status === 400) {
|
||||
const lockedError = data.errors.find(
|
||||
(error) => error.type === 'TRANSACTIONS_DATE_LOCKED',
|
||||
);
|
||||
if (lockedError) {
|
||||
if (
|
||||
data.errors.find(
|
||||
(error) => error.type === 'TRANSACTIONS_DATE_LOCKED',
|
||||
)
|
||||
) {
|
||||
setGlobalErrors({ transactionsLocked: { ...lockedError.data } });
|
||||
}
|
||||
if (
|
||||
data.errors.find(
|
||||
(e) => e.type === 'ORGANIZATION.SUBSCRIPTION.INACTIVE',
|
||||
)
|
||||
) {
|
||||
setGlobalErrors({ subscriptionInactive: true });
|
||||
}
|
||||
if (data.errors.find((e) => e.type === 'USER_INACTIVE')) {
|
||||
setGlobalErrors({ userInactive: true });
|
||||
setLogout();
|
||||
|
||||
Reference in New Issue
Block a user