api call baseUrl updated local to server call
This commit is contained in:
parent
82b9c76004
commit
81640be86a
@ -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('http://localhost:3003/api/auth/login', {
|
||||
const res = await fetch('https://ebay.backend.data4autos.com/api/auth/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
// credentials not required for same-origin, but harmless:
|
||||
|
||||
@ -8,7 +8,7 @@ import IconUser from '@/components/icon/icon-user';
|
||||
const API_BASE =
|
||||
process.env.NEXT_PUBLIC_API_BASE_URL?.replace(/\/$/, '') ||
|
||||
// 'https://ebay.backend.data4autos.com';
|
||||
'http://localhost:3003';
|
||||
'https://ebay.backend.data4autos.com';
|
||||
|
||||
|
||||
const ComponentsAuthRegisterForm = () => {
|
||||
|
||||
@ -26,7 +26,7 @@ const UserModule = () => {
|
||||
// ✅ Fetch users
|
||||
const fetchUsers = async () => {
|
||||
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 || []);
|
||||
setFilteredUsers(res.data?.users || []);
|
||||
} catch (err) {
|
||||
@ -80,11 +80,11 @@ const UserModule = () => {
|
||||
try {
|
||||
if (params.userid) {
|
||||
// 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');
|
||||
} else {
|
||||
// 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');
|
||||
}
|
||||
setAddUserModal(false);
|
||||
@ -113,7 +113,7 @@ const UserModule = () => {
|
||||
}).then(async (result) => {
|
||||
if (result.isConfirmed) {
|
||||
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');
|
||||
fetchUsers();
|
||||
} catch (err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user