diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts index a428f9a3..fe7baa62 100644 --- a/apps/api/src/controllers/auth.ts +++ b/apps/api/src/controllers/auth.ts @@ -64,7 +64,7 @@ async function getACUC(api_key: string): Promise { const cachedACUC = await getValue(cacheKeyACUC); if (cachedACUC !== null) { - return JSON.parse(cacheKeyACUC); + return JSON.parse(cachedACUC); } else { const { data, error } = await supabase_service.rpc("auth_credit_usage_chunk", { input_key: api_key }); diff --git a/apps/api/src/lib/checkCredits.ts b/apps/api/src/lib/checkCredits.ts deleted file mode 100644 index 7e9d988d..00000000 --- a/apps/api/src/lib/checkCredits.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { checkTeamCredits } from "../services/billing/credit_billing"; -import { Logger } from "./logger"; - -type checkCreditsResponse = { - status: number; - error: string | null; -} - -export const checkCredits = async (team_id: string): Promise => { - try { - const { - success: creditsCheckSuccess, - message: creditsCheckMessage - } = await checkTeamCredits(team_id, 1); - if (!creditsCheckSuccess) { - return { - status: 402, - error: "Insufficient credits" - }; - } - } catch (error) { - Logger.error(error); - return { - status: 500, - error: "Error checking team credits. Please contact hello@firecrawl.com for help." - }; - } - return { - status: 200, - error: null - } -}; \ No newline at end of file