api changes
This commit is contained in:
parent
7af72b5903
commit
e74a2710e5
@ -1,6 +1,6 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://ebay.backend.data4autos.com';
|
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://api.socialbuddy.co/api/users';
|
||||||
const SESSION_MAX_AGE_S = 30 * 60; // 30 minutes in seconds
|
const SESSION_MAX_AGE_S = 30 * 60; // 30 minutes in seconds
|
||||||
|
|
||||||
// Utility to extract userId from a nested object
|
// Utility to extract userId from a nested object
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://ebay.backend.data4autos.com';
|
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://api.socialbuddy.co/api/users';
|
||||||
|
|
||||||
export async function POST(req: Request) {
|
export async function POST(req: Request) {
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://ebay.backend.data4autos.com';
|
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://api.socialbuddy.co/api/users';
|
||||||
const TURN14_TOKEN_URL = 'https://turn14.data4autos.com/v1/auth/token';
|
const TURN14_TOKEN_URL = 'https://turn14.socialbuddy.com/v1/auth/token';
|
||||||
|
|
||||||
export async function POST(req: Request) {
|
export async function POST(req: Request) {
|
||||||
console.log('[turn14/save] Received POST request at', new Date().toISOString());
|
console.log('[turn14/save] Received POST request at', new Date().toISOString());
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
export async function POST(req: Request) {
|
export async function POST(req: Request) {
|
||||||
const body = await req.json();
|
const body = await req.json();
|
||||||
|
|
||||||
const upstream = await fetch('https://turn14.data4autos.com/v1/auth/token', {
|
const upstream = await fetch('https://turn14.socialbuddy.com/v1/auth/token', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://ebay.backend.data4autos.com';
|
const AUTH_API_BASE = process.env.AUTH_API_BASE ?? 'https://api.socialbuddy.co/api/users';
|
||||||
const TURN14_TOKEN_URL = 'https://turn14.data4autos.com/v1/auth/token';
|
const TURN14_TOKEN_URL = 'https://turn14.socialbuddy.com/v1/auth/token';
|
||||||
|
|
||||||
export async function POST(req: Request) {
|
export async function POST(req: Request) {
|
||||||
//console.log('Received POST request to /api/turn14/update-token');
|
//console.log('Received POST request to /api/turn14/update-token');
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export default function ForgotPasswordForm() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await axios.post(
|
await axios.post(
|
||||||
"https://ebay.backend.data4autos.com/api/auth/forgot-password",
|
"https://api.socialbuddy.co/api/auth/forgot-password",
|
||||||
{ email }
|
{ 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.");
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const ComponentsAuthLoginForm = () => {
|
|||||||
try {
|
try {
|
||||||
// ✅ SAME backend logic as your old working code
|
// ✅ SAME backend logic as your old working code
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
'https://ebay.backend.data4autos.com/api/auth/login',
|
'https://api.socialbuddy.co/api/auth/login',
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
@ -192,7 +192,7 @@ const ComponentsAuthLoginForm = () => {
|
|||||||
{/* Google Sign-in */}
|
{/* Google Sign-in */}
|
||||||
<div className="flex justify-center px-8 mb-4">
|
<div className="flex justify-center px-8 mb-4">
|
||||||
<Link
|
<Link
|
||||||
href="https://ebay.backend.data4autos.com/api/auth/google/"
|
href="https://api.socialbuddy.co/api/auth/google/"
|
||||||
className="flex items-center gap-3 px-8 py-3 rounded-lg
|
className="flex items-center gap-3 px-8 py-3 rounded-lg
|
||||||
border border-white/20 text-white
|
border border-white/20 text-white
|
||||||
hover:bg-white/10 transition active:scale-[0.98]"
|
hover:bg-white/10 transition active:scale-[0.98]"
|
||||||
|
|||||||
@ -7,7 +7,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://api.socialbuddy.co/api/users';
|
||||||
|
|
||||||
const ComponentsAuthRegisterForm = () => {
|
const ComponentsAuthRegisterForm = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@ -38,7 +38,7 @@ const ComponentsAuthChangePasswordForm = () => {
|
|||||||
formData.append('newPassword', newPassword);
|
formData.append('newPassword', newPassword);
|
||||||
|
|
||||||
const res = await axios.post<ChangePasswordResponse>(
|
const res = await axios.post<ChangePasswordResponse>(
|
||||||
`https://ebay.backend.data4autos.com/api/auth/change-password`,
|
`https://api.socialbuddy.co/api/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://api.socialbuddy.co/api/auth/protected", { withCredentials: true })
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
const userData = res.data.user;
|
const userData = res.data.user;
|
||||||
if (userData) {
|
if (userData) {
|
||||||
|
|||||||
@ -72,7 +72,7 @@
|
|||||||
localStorage.setItem('navbar', params.navbar);
|
localStorage.setItem('navbar', params.navbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.href = 'https://Data4Autos-next.vercel.app/';
|
window.location.href = 'https://socialbuddy-next.vercel.app/';
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user