Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: Add redirect to auth on pricing
Richie McIlroyf8c56cf13af9
diff --git a/apps/web/app/api/settings/billing/subscribe/route.ts b/apps/web/app/api/settings/billing/subscribe/route.tsindex a47975938..52da04f9d 100644--- a/apps/web/app/api/settings/billing/subscribe/route.ts+++ b/apps/web/app/api/settings/billing/subscribe/route.ts@@ -24,7 +24,7 @@ export async function POST(request: NextRequest) {if (!user) {console.error("User not found");- return new Response(JSON.stringify({ error: true }), {+ return new Response(JSON.stringify({ error: true, auth: false }), {status: 401,headers: {"Content-Type": "application/json",diff --git a/apps/web/components/pages/PricingPage.tsx b/apps/web/components/pages/PricingPage.tsxindex 4987cf71c..54abb2555 100644--- a/apps/web/components/pages/PricingPage.tsx+++ b/apps/web/components/pages/PricingPage.tsx@@ -14,9 +14,11 @@ import { Check, Construction } from "lucide-react";import { useState } from "react";import { getProPlanId } from "@cap/utils";import toast from "react-hot-toast";+import { useRouter } from "next/navigation";export const PricingPage = () => {const [loading, setLoading] = useState(false);+ const { push } = useRouter();const planCheckout = async () => {setLoading(true);@@ -35,6 +37,10 @@ export const PricingPage = () => {console.log(data);+ if (data.auth === false) {+ push("/login");+ }+if (data.subscription === true) {toast.success("You are already on the Cap Pro plan");}