diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index d22844c..7e81daa 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -86,16 +86,7 @@ const CoverLogin = () => { - {/* Sign-up link */} -
- Don't have an account?  - - SIGN UP - -
+ {/* Footer */} diff --git a/app/api/auth/login/route.ts b/app/api/auth/login/route.ts index f3eb2e3..7e9a35f 100644 --- a/app/api/auth/login/route.ts +++ b/app/api/auth/login/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server'; -const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://ebay.backend.vgproducts.com'; +const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'http://localhost:3050'; const SESSION_MAX_AGE_S = 30 * 60; // 30 minutes in seconds // Utility to extract userId from a nested object diff --git a/app/api/auth/signup/route.ts b/app/api/auth/signup/route.ts index e251e34..73f3e99 100644 --- a/app/api/auth/signup/route.ts +++ b/app/api/auth/signup/route.ts @@ -1,6 +1,6 @@ import { NextResponse } from 'next/server'; -const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://ebay.backend.vgproducts.com'; +const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'http://localhost:3050'; export async function POST(req: Request) { const body = await req.json(); diff --git a/components/auth/components-auth-forgot-form.tsx b/components/auth/components-auth-forgot-form.tsx index 2f1ec60..639cb0e 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.vgproducts.com/api/auth/forgot-password", { email }); + const res = await axios.post("http://localhost:3050/api/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 63f3c50..45930f0 100644 --- a/components/auth/components-auth-login-form.tsx +++ b/components/auth/components-auth-login-form.tsx @@ -7,7 +7,7 @@ import IconMail from '@/components/icon/icon-mail'; const ComponentsAuthLoginForm = () => { const router = useRouter(); const searchParams = useSearchParams(); - const nextUrl = searchParams.get('next') || '/'; + const nextUrl = searchParams.get('next') || '/user'; const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); @@ -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.vgproducts.com/api/auth/login', { + const res = await fetch('http://localhost:3050/api/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 4760280..fc49ad1 100644 --- a/components/auth/components-auth-register-form.tsx +++ b/components/auth/components-auth-register-form.tsx @@ -7,8 +7,8 @@ import IconUser from '@/components/icon/icon-user'; const API_BASE = process.env.NEXT_PUBLIC_API_BASE_URL?.replace(/\/$/, '') || - // 'https://ebay.backend.vgproducts.com'; - 'https://ebay.backend.vgproducts.com'; + // 'http://localhost:3050'; + 'http://localhost:3050'; const ComponentsAuthRegisterForm = () => { diff --git a/components/auth/components-auth-unlock-form.tsx b/components/auth/components-auth-unlock-form.tsx index 64c4de8..5c9b6b4 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.vgproducts.com/api/auth/change-password`, + `http://localhost:3050/api/auth/change-password`, formData, { headers: { diff --git a/components/layouts/header.tsx b/components/layouts/header.tsx index ed58f93..a10359d 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.vgproducts.com/api/auth/protected", { withCredentials: true }) + .get("http://localhost:3050/api/auth/protected", { withCredentials: true }) .then((res: any) => { const userData = res.data.user; if (userData) { @@ -218,9 +218,7 @@ const Header = () => { - logo - logo - {/* VG Products */} + VG Products diff --git a/components/layouts/sidebar.tsx b/components/layouts/sidebar.tsx index 046e5e5..27f5615 100644 --- a/components/layouts/sidebar.tsx +++ b/components/layouts/sidebar.tsx @@ -66,10 +66,8 @@ const Sidebar = () => { >
- - logo - logo - {/* VG Products */} + + VG Products
*/} -
  • - -
    - 🏠 - {t('Dashboard')} -
    - -
  • - {/*
    - */} + {/* Dashboard removed */} -

    - - {t('settings')} -

    + {/* Settings header removed */}
  • diff --git a/components/user/user-module.tsx b/components/user/user-module.tsx index a546326..a62b1c5 100644 --- a/components/user/user-module.tsx +++ b/components/user/user-module.tsx @@ -14,11 +14,11 @@ const UserModule = () => { const [addUserModal, setAddUserModal] = useState(false); const defaultParams = { - userid: null, + _id: null, name: '', email: '', password: '', - phonenumber: '', + mobileNumber: '', role: 'customer', }; const [params, setParams] = useState({ ...defaultParams }); @@ -26,9 +26,10 @@ const UserModule = () => { // ✅ Fetch users const fetchUsers = async () => { try { - const res = await axios.get('https://ebay.backend.vgproducts.com/api/auth/users'); - setUsers(res.data?.users || []); - setFilteredUsers(res.data?.users || []); + const res = await axios.get('http://localhost:3050/api/users'); + const usersList = Array.isArray(res.data) ? res.data : (res.data?.users || []); + setUsers(usersList); + setFilteredUsers(usersList); } catch (err) { console.error(err); showMessage('Failed to load users', 'error'); @@ -72,19 +73,19 @@ const UserModule = () => { // ✅ Add / Update User const saveUser = async () => { - if (!params.name || !params.email || !params.phonenumber || !params.role) { + if (!params.name || !params.email || !params.role) { showMessage('Please fill all required fields', 'error'); return; } try { - if (params.userid) { + if (params._id) { // UPDATE - await axios.put(`https://ebay.backend.vgproducts.com/api/auth/users/${params.userid}`, params); + await axios.put(`http://localhost:3050/api/users/${params._id}`, params); showMessage('User updated successfully'); } else { // ADD - await axios.post('https://ebay.backend.vgproducts.com/api/auth/users/add', params); + await axios.post('http://localhost:3050/api/users/create', params); showMessage('User added successfully'); } setAddUserModal(false); @@ -113,7 +114,7 @@ const UserModule = () => { }).then(async (result) => { if (result.isConfirmed) { try { - await axios.delete(`https://ebay.backend.vgproducts.com/api/auth/users/${user.userid}`); + await axios.delete(`http://localhost:3050/api/users/${user._id}`); showMessage('User deleted successfully'); fetchUsers(); } catch (err) { @@ -174,10 +175,10 @@ const UserModule = () => { {filteredUsers.map((user: any) => ( - + {user.name} {user.email} - {user.phonenumber} + {user.mobileNumber} {user.role}
    @@ -241,7 +242,7 @@ const UserModule = () => {
    - {params.userid ? 'Edit User' : 'Add User'} + {params._id ? 'Edit User' : 'Add User'}
    @@ -267,7 +268,7 @@ const UserModule = () => { placeholder="Enter email" />
    - {!params.userid && ( + {!params._id && (
    {
    @@ -316,7 +317,7 @@ const UserModule = () => { className="btn btn-primary ltr:ml-4 rtl:mr-4" onClick={saveUser} > - {params.userid ? 'Update' : 'Add'} + {params._id ? 'Update' : 'Add'}