api call baseUrl updated local to server call

This commit is contained in:
Alaguraj0361 2025-11-04 21:41:22 +05:30
parent 82b9c76004
commit 81640be86a
3 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ const ComponentsAuthLoginForm = () => {
setLoading(true); setLoading(true);
try { try {
// ✅ Call your Next.js API (same origin), which sets d4a_uid, d4a_session, d4a_exp cookies // ✅ Call your Next.js API (same origin), which sets d4a_uid, d4a_session, d4a_exp cookies
const res = await fetch('http://localhost:3003/api/auth/login', { const res = await fetch('https://ebay.backend.data4autos.com/api/auth/login', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
// credentials not required for same-origin, but harmless: // credentials not required for same-origin, but harmless:

View File

@ -8,7 +8,7 @@ import IconUser from '@/components/icon/icon-user';
const API_BASE = const API_BASE =
process.env.NEXT_PUBLIC_API_BASE_URL?.replace(/\/$/, '') || process.env.NEXT_PUBLIC_API_BASE_URL?.replace(/\/$/, '') ||
// 'https://ebay.backend.data4autos.com'; // 'https://ebay.backend.data4autos.com';
'http://localhost:3003'; 'https://ebay.backend.data4autos.com';
const ComponentsAuthRegisterForm = () => { const ComponentsAuthRegisterForm = () => {

View File

@ -26,7 +26,7 @@ const UserModule = () => {
// ✅ Fetch users // ✅ Fetch users
const fetchUsers = async () => { const fetchUsers = async () => {
try { try {
const res = await axios.get('http://localhost:3003/api/auth/users'); const res = await axios.get('https://ebay.backend.data4autos.com/api/auth/users');
setUsers(res.data?.users || []); setUsers(res.data?.users || []);
setFilteredUsers(res.data?.users || []); setFilteredUsers(res.data?.users || []);
} catch (err) { } catch (err) {
@ -80,11 +80,11 @@ const UserModule = () => {
try { try {
if (params.userid) { if (params.userid) {
// UPDATE // UPDATE
await axios.put(`http://localhost:3003/api/auth/users/${params.userid}`, params); await axios.put(`https://ebay.backend.data4autos.com/api/auth/users/${params.userid}`, params);
showMessage('User updated successfully'); showMessage('User updated successfully');
} else { } else {
// ADD // ADD
await axios.post('http://localhost:3003/api/auth/users/add', params); await axios.post('https://ebay.backend.data4autos.com/api/auth/users/add', params);
showMessage('User added successfully'); showMessage('User added successfully');
} }
setAddUserModal(false); setAddUserModal(false);
@ -113,7 +113,7 @@ const UserModule = () => {
}).then(async (result) => { }).then(async (result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
try { try {
await axios.delete(`http://localhost:3003/api/auth/users/${user.userid}`); await axios.delete(`https://ebay.backend.data4autos.com/api/auth/users/${user.userid}`);
showMessage('User deleted successfully'); showMessage('User deleted successfully');
fetchUsers(); fetchUsers();
} catch (err) { } catch (err) {