From d7810ace9697d5ebc1479f33ea3aee975035f16d Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Sivakumar Date: Sun, 5 Jul 2026 16:25:32 +0530 Subject: [PATCH] fix(auth): change all /api/gateway/auth endpoints to /api/auth for forgot-password, login, and dashboard --- src/components/DashboardLayout.tsx | 2 +- src/lib/auth.tsx | 2 +- src/routes/dashboard.tsx | 4 ++-- src/routes/forgot-password.tsx | 4 ++-- src/routes/login.tsx | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/DashboardLayout.tsx b/src/components/DashboardLayout.tsx index 1a6f528..61a6f60 100644 --- a/src/components/DashboardLayout.tsx +++ b/src/components/DashboardLayout.tsx @@ -100,7 +100,7 @@ export default function DashboardLayout(props: ParentProps) { const token = sessionStorage.getItem("nxtgauge_access_token"); if (token) { try { - const res = await fetch("/api/gateway/auth/session", { + const res = await fetch("/api/auth/session", { headers: { Accept: "application/json", Authorization: `Bearer ${token}`, diff --git a/src/lib/auth.tsx b/src/lib/auth.tsx index 6e8e731..f530524 100644 --- a/src/lib/auth.tsx +++ b/src/lib/auth.tsx @@ -82,7 +82,7 @@ async function fetchSession(): Promise { const token = getToken(); if (!token) return null; try { - const res = await fetch("/api/gateway/auth/session", { + const res = await fetch("/api/auth/session", { headers: { Accept: 'application/json', Authorization: `Bearer ${token}`, diff --git a/src/routes/dashboard.tsx b/src/routes/dashboard.tsx index 7200127..7164b10 100644 --- a/src/routes/dashboard.tsx +++ b/src/routes/dashboard.tsx @@ -668,7 +668,7 @@ export default function RuntimeDashboardPage() { const email = authEmail || getEmailFromStorage(); if (!email) return; - const checkRes = await fetch("/api/gateway/auth/check-email", { + const checkRes = await fetch("/api/auth/check-email", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, credentials: "include", @@ -691,7 +691,7 @@ export default function RuntimeDashboardPage() { const token = getToken(); if (token) { - const switchRes = await fetch("/api/gateway/auth/switch-role", { + const switchRes = await fetch("/api/auth/switch-role", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/src/routes/forgot-password.tsx b/src/routes/forgot-password.tsx index 4d21e6a..f2f1b83 100644 --- a/src/routes/forgot-password.tsx +++ b/src/routes/forgot-password.tsx @@ -48,7 +48,7 @@ export default function ForgotPasswordRoute() { } setSubmitting(true); try { - const res = await fetch('/api/gateway/auth/forgot-password', { + const res = await fetch('/api/auth/forgot-password', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: email().trim().toLowerCase() }), @@ -82,7 +82,7 @@ export default function ForgotPasswordRoute() { } setSubmitting(true); try { - const res = await fetch('/api/gateway/auth/reset-password', { + const res = await fetch('/api/auth/reset-password', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ diff --git a/src/routes/login.tsx b/src/routes/login.tsx index 3867a8b..452324a 100644 --- a/src/routes/login.tsx +++ b/src/routes/login.tsx @@ -133,7 +133,7 @@ export default function LoginRoute() { } setCheckingRole(true); try { - const response = await fetch("/api/gateway/auth/check-email", { + const response = await fetch("/api/auth/check-email", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, credentials: "include", @@ -243,7 +243,7 @@ export default function LoginRoute() { } setSubmitting(true); try { - const res = await fetch("/api/gateway/auth/login", { + const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, credentials: "include", @@ -283,7 +283,7 @@ export default function LoginRoute() { if (discoveredRoleKeys.length === 0 || isJobSeekerRole(discoveredActiveRole)) { try { - const checkRes = await fetch("/api/gateway/auth/check-email", { + const checkRes = await fetch("/api/auth/check-email", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, credentials: "include", @@ -324,7 +324,7 @@ export default function LoginRoute() { let desiredRoleKey = discoveredActiveRole; if (finalAccessToken && requestedRoleKey && requestedRoleKey !== discoveredActiveRole) { try { - const switchRes = await fetch("/api/gateway/auth/switch-role", { + const switchRes = await fetch("/api/auth/switch-role", { method: "POST", headers: { "Content-Type": "application/json", @@ -385,7 +385,7 @@ export default function LoginRoute() { setError(""); setSubmitting(true); try { - const res = await fetch("/api/gateway/auth/resend-otp", { + const res = await fetch("/api/auth/resend-otp", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, credentials: "include", @@ -409,7 +409,7 @@ export default function LoginRoute() { } setSubmitting(true); try { - const verifyRes = await fetch("/api/gateway/auth/verify-email", { + const verifyRes = await fetch("/api/auth/verify-email", { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, credentials: "include",