From 10d386bc7d1fb5e4921cc8801dd3c6a9e49db246 Mon Sep 17 00:00:00 2001 From: MOHAN Date: Fri, 17 Jul 2026 23:36:31 +0530 Subject: [PATCH] Add credit score pull UI --- app/api/credit-score/pull/route.ts | 6 ++++++ app/credit-score/page.tsx | 31 +++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 app/api/credit-score/pull/route.ts diff --git a/app/api/credit-score/pull/route.ts b/app/api/credit-score/pull/route.ts new file mode 100644 index 0000000..932ac3a --- /dev/null +++ b/app/api/credit-score/pull/route.ts @@ -0,0 +1,6 @@ +import { NextRequest } from "next/server"; +import { proxyRequest } from "@/lib/backend"; + +export async function POST(req: NextRequest) { + return proxyRequest(req, "credit-score/pull"); +} diff --git a/app/credit-score/page.tsx b/app/credit-score/page.tsx index 55f60ff..87c7128 100644 --- a/app/credit-score/page.tsx +++ b/app/credit-score/page.tsx @@ -108,6 +108,26 @@ export default function CreditScorePage() { await load(); }; + const pullScore = async () => { + const bureau = ["experian", "equifax", "transunion"].includes(form.bureau) ? form.bureau : "experian"; + const res = await apiFetch("/api/credit-score/pull", { + method: "POST", + body: JSON.stringify({ + bureau, + consent: { + acceptedAt: new Date().toISOString(), + purpose: "credit_score_monitoring", + }, + }), + }); + if (res.error) { + setStatus(res.error.message ?? "Unable to pull credit score."); + return; + } + setStatus(`${bureau} score pulled: ${res.data.score}.`); + await load(); + }; + const inputCls = "mt-2 w-full rounded-xl border border-border bg-background/50 px-4 py-2 text-sm text-foreground focus:border-primary focus:ring-primary focus:outline-none"; const labelCls = "text-xs text-muted-foreground font-semibold uppercase tracking-wider"; @@ -175,9 +195,14 @@ export default function CreditScorePage() { setForm((prev) => ({ ...prev, negativeFactors: event.target.value }))} className={inputCls} placeholder="hard inquiry, high balance" /> - +
+ + +
{status &&

{status}

}