api changes
This commit is contained in:
parent
400eb9e47f
commit
3a1a9346c7
@ -157,7 +157,7 @@ const CoverLogin = () => {
|
||||
</li>
|
||||
<li>
|
||||
<Link
|
||||
href="https://ebay.backend.data4autos.com/api/auth/facebook/"
|
||||
href="https://ebay.backend.data4autos.com/api/motorstate/auth/facebook/"
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-full p-0 transition hover:scale-110"
|
||||
style={{ background: 'linear-gradient(135deg, #0EA5E9 0%, #19D4FB 50%, #67E8F9 100%)' }}
|
||||
>
|
||||
@ -175,7 +175,7 @@ const CoverLogin = () => {
|
||||
</li> */}
|
||||
<li>
|
||||
<Link
|
||||
href="https://ebay.backend.data4autos.com/api/auth/google/"
|
||||
href="https://ebay.backend.data4autos.com/api/motorstate/auth/google/"
|
||||
className="inline-flex h-8 w-8 items-center justify-center rounded-full p-0 transition hover:scale-110"
|
||||
style={{ background: 'linear-gradient(135deg, #0EA5E9 0%, #19D4FB 50%, #67E8F9 100%)' }}
|
||||
>
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -40,7 +40,7 @@ const ComponentsAuthChangePasswordForm = () => {
|
||||
|
||||
// ✅ Axios call with generic type
|
||||
const res = await axios.post<ChangePasswordResponse>(
|
||||
`https://ebay.backend.data4autos.com/api/auth/change-password`,
|
||||
`https://ebay.backend.data4autos.com/api/motorstate/auth/change-password`,
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user