fix: limits no longer cache during session changes

This commit is contained in:
Mythie
2023-10-22 11:18:00 +11:00
parent c02640e104
commit 0b50176178
3 changed files with 11 additions and 14 deletions

View File

@@ -3,7 +3,6 @@ import { NextApiRequest, NextApiResponse } from 'next';
import { getToken } from 'next-auth/jwt';
import { match } from 'ts-pattern';
import { withStaleWhileRevalidate } from '@documenso/lib/server-only/http/with-swr';
import { getFlag } from '@documenso/lib/universal/get-feature-flag';
import { SELFHOSTED_PLAN_LIMITS } from './constants';
@@ -21,7 +20,7 @@ export const limitsHandler = async (
const isBillingEnabled = await getFlag('app_billing');
if (!isBillingEnabled) {
return withStaleWhileRevalidate<typeof res>(res).status(200).json({
return res.status(200).json({
quota: SELFHOSTED_PLAN_LIMITS,
remaining: SELFHOSTED_PLAN_LIMITS,
});
@@ -33,7 +32,7 @@ export const limitsHandler = async (
const limits = await getServerLimits({ email: token.email });
return withStaleWhileRevalidate<typeof res>(res).status(200).json(limits);
return res.status(200).json(limits);
} catch (err) {
console.error('error', err);