api changes
This commit is contained in:
parent
400eb9e47f
commit
3a1a9346c7
@ -157,7 +157,7 @@ const CoverLogin = () => {
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<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"
|
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%)' }}
|
style={{ background: 'linear-gradient(135deg, #0EA5E9 0%, #19D4FB 50%, #67E8F9 100%)' }}
|
||||||
>
|
>
|
||||||
@ -175,7 +175,7 @@ const CoverLogin = () => {
|
|||||||
</li> */}
|
</li> */}
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<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"
|
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%)' }}
|
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));
|
console.log('[login] Request body at', new Date().toISOString(), ':', JSON.stringify(body, null, 2));
|
||||||
|
|
||||||
// Proxy request to upstream API
|
// 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',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
|
|
||||||
// Forward to your backend
|
// 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',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(body),
|
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));
|
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',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export async function POST(req: Request) {
|
|||||||
};
|
};
|
||||||
//console.log('Sending payload to upstream:', payload);
|
//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',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(payload),
|
body: JSON.stringify(payload),
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export default function ForgotPasswordForm() {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
setMessage("");
|
setMessage("");
|
||||||
try {
|
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.");
|
setMessage("✅ We’ve emailed you a reset code / link. Enter it below.");
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|||||||
@ -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('https://ebay.backend.data4autos.com/api/auth/login', {
|
const res = await fetch('https://ebay.backend.data4autos.com/api/motorstate/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:
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const ComponentsAuthRegisterForm = () => {
|
|||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${API_BASE}/api/auth/signup`, {
|
const res = await fetch(`${API_BASE}/api/motorstate/auth/signup`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
// If your API sets cookies, uncomment:
|
// If your API sets cookies, uncomment:
|
||||||
|
|||||||
@ -40,7 +40,7 @@ const ComponentsAuthChangePasswordForm = () => {
|
|||||||
|
|
||||||
// ✅ Axios call with generic type
|
// ✅ Axios call with generic type
|
||||||
const res = await axios.post<ChangePasswordResponse>(
|
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,
|
formData,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -54,7 +54,7 @@ const Header = () => {
|
|||||||
setUser(email);
|
setUser(email);
|
||||||
} else {
|
} else {
|
||||||
axios
|
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) => {
|
.then((res: any) => {
|
||||||
const userData = res.data.user;
|
const userData = res.data.user;
|
||||||
if (userData) {
|
if (userData) {
|
||||||
|
|||||||
@ -26,7 +26,7 @@ const UserModule = () => {
|
|||||||
// ✅ Fetch users
|
// ✅ Fetch users
|
||||||
const fetchUsers = async () => {
|
const fetchUsers = async () => {
|
||||||
try {
|
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 || []);
|
setUsers(res.data?.users || []);
|
||||||
setFilteredUsers(res.data?.users || []);
|
setFilteredUsers(res.data?.users || []);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -81,11 +81,11 @@ const UserModule = () => {
|
|||||||
try {
|
try {
|
||||||
if (params.userid) {
|
if (params.userid) {
|
||||||
// UPDATE
|
// 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');
|
showMessage('User updated successfully');
|
||||||
} else {
|
} else {
|
||||||
// ADD
|
// 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');
|
showMessage('User added successfully');
|
||||||
}
|
}
|
||||||
setAddUserModal(false);
|
setAddUserModal(false);
|
||||||
@ -114,7 +114,7 @@ const UserModule = () => {
|
|||||||
}).then(async (result) => {
|
}).then(async (result) => {
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
try {
|
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');
|
showMessage('User deleted successfully');
|
||||||
fetchUsers();
|
fetchUsers();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user