From 3a1a9346c76ed40ecfce562722283bf339e63cc7 Mon Sep 17 00:00:00 2001 From: Kishorekumar5567 Date: Wed, 7 Jan 2026 00:33:07 +0530 Subject: [PATCH] api changes --- app/(auth)/login/page.tsx | 4 ++-- app/api/auth/login/route.ts | 2 +- app/api/auth/signup/route.ts | 2 +- app/api/turn14/save/route.ts | 2 +- app/api/turn14/update-token/route.ts | 2 +- components/auth/components-auth-forgot-form.tsx | 2 +- components/auth/components-auth-login-form.tsx | 2 +- components/auth/components-auth-register-form.tsx | 2 +- components/auth/components-auth-unlock-form.tsx | 2 +- components/layouts/header.tsx | 2 +- components/user/user-module.tsx | 8 ++++---- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 5284334..193314b 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -157,7 +157,7 @@ const CoverLogin = () => {
  • @@ -175,7 +175,7 @@ const CoverLogin = () => {
  • */}
  • diff --git a/app/api/auth/login/route.ts b/app/api/auth/login/route.ts index d40db18..9533ffc 100644 --- a/app/api/auth/login/route.ts +++ b/app/api/auth/login/route.ts @@ -40,7 +40,7 @@ export async function POST(req: Request) { console.log('[login] Request body at', new Date().toISOString(), ':', JSON.stringify(body, null, 2)); // Proxy request to upstream API - const upstream = await fetch(`${AUTH_API_BASE}/api/auth/login`, { + const upstream = await fetch(`${AUTH_API_BASE}/api/motorstate/auth/login`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), diff --git a/app/api/auth/signup/route.ts b/app/api/auth/signup/route.ts index 487f056..9c1674f 100644 --- a/app/api/auth/signup/route.ts +++ b/app/api/auth/signup/route.ts @@ -6,7 +6,7 @@ export async function POST(req: Request) { const body = await req.json(); // Forward to your backend - const upstream = await fetch(`${AUTH_API_BASE}/api/auth/signup`, { + const upstream = await fetch(`${AUTH_API_BASE}/api/motorstate/auth/signup`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), diff --git a/app/api/turn14/save/route.ts b/app/api/turn14/save/route.ts index 2bdac00..438af26 100644 --- a/app/api/turn14/save/route.ts +++ b/app/api/turn14/save/route.ts @@ -82,7 +82,7 @@ export async function POST(req: Request) { console.log('[turn14/save] Sending payload to upstream:', JSON.stringify(payload, null, 2)); - const upstream = await fetch(`${AUTH_API_BASE}/api/auth/turn14/save`, { + const upstream = await fetch(`${AUTH_API_BASE}/api/motorstate/auth/turn14/save`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), diff --git a/app/api/turn14/update-token/route.ts b/app/api/turn14/update-token/route.ts index 2f173c6..508a4d2 100644 --- a/app/api/turn14/update-token/route.ts +++ b/app/api/turn14/update-token/route.ts @@ -63,7 +63,7 @@ export async function POST(req: Request) { }; //console.log('Sending payload to upstream:', payload); - const upstream = await fetch(`${AUTH_API_BASE}/api/auth/turn14/update-token`, { + const upstream = await fetch(`${AUTH_API_BASE}/api/motorstate/auth/turn14/update-token`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload), diff --git a/components/auth/components-auth-forgot-form.tsx b/components/auth/components-auth-forgot-form.tsx index c3d8a60..83ff3ff 100644 --- a/components/auth/components-auth-forgot-form.tsx +++ b/components/auth/components-auth-forgot-form.tsx @@ -13,7 +13,7 @@ export default function ForgotPasswordForm() { setLoading(true); setMessage(""); try { - const res = await axios.post("https://ebay.backend.data4autos.com/api/auth/forgot-password", { email }); + const res = await axios.post("https://ebay.backend.data4autos.com/api/motorstate/auth/forgot-password", { email }); setMessage("✅ We’ve emailed you a reset code / link. Enter it below."); } catch (err: any) { console.error(err); diff --git a/components/auth/components-auth-login-form.tsx b/components/auth/components-auth-login-form.tsx index ce0fe72..b6d18a6 100644 --- a/components/auth/components-auth-login-form.tsx +++ b/components/auth/components-auth-login-form.tsx @@ -29,7 +29,7 @@ const ComponentsAuthLoginForm = () => { setLoading(true); try { // ✅ Call your Next.js API (same origin), which sets d4a_uid, d4a_session, d4a_exp cookies - const res = await fetch('https://ebay.backend.data4autos.com/api/auth/login', { + const res = await fetch('https://ebay.backend.data4autos.com/api/motorstate/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, // credentials not required for same-origin, but harmless: diff --git a/components/auth/components-auth-register-form.tsx b/components/auth/components-auth-register-form.tsx index bba0fc2..f3a3230 100644 --- a/components/auth/components-auth-register-form.tsx +++ b/components/auth/components-auth-register-form.tsx @@ -36,7 +36,7 @@ const ComponentsAuthRegisterForm = () => { setLoading(true); try { - const res = await fetch(`${API_BASE}/api/auth/signup`, { + const res = await fetch(`${API_BASE}/api/motorstate/auth/signup`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, // If your API sets cookies, uncomment: diff --git a/components/auth/components-auth-unlock-form.tsx b/components/auth/components-auth-unlock-form.tsx index 1856ca8..35afcf3 100644 --- a/components/auth/components-auth-unlock-form.tsx +++ b/components/auth/components-auth-unlock-form.tsx @@ -40,7 +40,7 @@ const ComponentsAuthChangePasswordForm = () => { // ✅ Axios call with generic type const res = await axios.post( - `https://ebay.backend.data4autos.com/api/auth/change-password`, + `https://ebay.backend.data4autos.com/api/motorstate/auth/change-password`, formData, { headers: { diff --git a/components/layouts/header.tsx b/components/layouts/header.tsx index 9e29fb2..48f937c 100644 --- a/components/layouts/header.tsx +++ b/components/layouts/header.tsx @@ -54,7 +54,7 @@ const Header = () => { setUser(email); } else { axios - .get("https://ebay.backend.data4autos.com/api/auth/protected", { withCredentials: true }) + .get("https://ebay.backend.data4autos.com/api/motorstate/auth/protected", { withCredentials: true }) .then((res: any) => { const userData = res.data.user; if (userData) { diff --git a/components/user/user-module.tsx b/components/user/user-module.tsx index ac59641..66dd530 100644 --- a/components/user/user-module.tsx +++ b/components/user/user-module.tsx @@ -26,7 +26,7 @@ const UserModule = () => { // ✅ Fetch users const fetchUsers = async () => { try { - const res = await axios.get('https://ebay.backend.data4autos.com/api/auth/users'); + const res = await axios.get('https://ebay.backend.data4autos.com/api/motorstate/auth/users'); setUsers(res.data?.users || []); setFilteredUsers(res.data?.users || []); } catch (err) { @@ -81,11 +81,11 @@ const UserModule = () => { try { if (params.userid) { // UPDATE - await axios.put(`https://ebay.backend.data4autos.com/api/auth/users/${params.userid}`, params); + await axios.put(`https://ebay.backend.data4autos.com/api/motorstate/auth/users/${params.userid}`, params); showMessage('User updated successfully'); } else { // ADD - await axios.post('https://ebay.backend.data4autos.com/api/auth/users/add', params); + await axios.post('https://ebay.backend.data4autos.com/api/motorstate/auth/users/add', params); showMessage('User added successfully'); } setAddUserModal(false); @@ -114,7 +114,7 @@ const UserModule = () => { }).then(async (result) => { if (result.isConfirmed) { try { - await axios.delete(`https://ebay.backend.data4autos.com/api/auth/users/${user.userid}`); + await axios.delete(`https://ebay.backend.data4autos.com/api/motorstate/auth/users/${user.userid}`); showMessage('User deleted successfully'); fetchUsers(); } catch (err) {