mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
fix: Subscription active detarminer
This commit is contained in:
@@ -2,7 +2,6 @@ import { Container } from 'typedi';
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
|
||||
const SupportedMethods = ['POST', 'PUT'];
|
||||
const Excluded = [];
|
||||
|
||||
export default (subscriptionSlug = 'main') =>
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
@@ -22,7 +21,10 @@ export default (subscriptionSlug = 'main') =>
|
||||
errors: [{ type: 'TENANT.HAS.NO.SUBSCRIPTION' }],
|
||||
});
|
||||
}
|
||||
if (SupportedMethods.includes(req.method) && subscription.inactive()) {
|
||||
const isMethodSupported = SupportedMethods.includes(req.method);
|
||||
const isSubscriptionInactive = subscription.inactive();
|
||||
|
||||
if (isMethodSupported && isSubscriptionInactive) {
|
||||
return res.boom.badRequest(null, {
|
||||
errors: [{ type: 'ORGANIZATION.SUBSCRIPTION.INACTIVE' }],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user