diff --git a/app/api/customer/route.ts b/app/api/customer/route.ts index 199ce5bd5..8a4eb9a21 100644 --- a/app/api/customer/route.ts +++ b/app/api/customer/route.ts @@ -6,10 +6,10 @@ import { NextRequest, NextResponse } from 'next/server'; export async function GET(req: NextRequest) { try { const session = await getServerSession(authOptions); - if (!session?.user?.store_id) { + if (!session?.user?.customer_id) { return NextResponse.json({ error: 'User not logged' }, { status: 401 }); } - const customer = await woocommerce.get('customers', { id: session?.user.store_id }); + const customer = await woocommerce.get('customers', { id: session?.user.customer_id }); return NextResponse.json(customer, { status: 200 }); } catch (error) { return NextResponse.json({ error: JSON.stringify(error) }, { status: 500 }); diff --git a/app/profile/@user/orders/page.tsx b/app/profile/@user/orders/page.tsx index ea97ae9af..662b26493 100644 --- a/app/profile/@user/orders/page.tsx +++ b/app/profile/@user/orders/page.tsx @@ -9,7 +9,7 @@ import Link from 'next/link'; export default async function OrdersPage() { const t = await getTranslations('ProfilePage'); const data = await getServerSession(authOptions); - const orders = await woocommerce.get('orders', { customer: data?.user?.store_id }); + const orders = await woocommerce.get('orders', { customer: data?.user?.customer_id }); return (
diff --git a/app/profile/@user/page.tsx b/app/profile/@user/page.tsx index a972d5989..98aa2239a 100644 --- a/app/profile/@user/page.tsx +++ b/app/profile/@user/page.tsx @@ -8,11 +8,11 @@ import { getTranslations } from 'next-intl/server'; export default async function PersonalArea() { const session = await getServerSession(authOptions); const t = await getTranslations('ProfilePage'); - if (!session?.user?.store_id) { + if (!session?.user?.customer_id) { return { status: 401, body: { error: 'User not logged' } }; } - const customer = await woocommerce.get('customers', { id: session?.user.store_id }); + const customer = await woocommerce.get('customers', { id: session?.user.customer_id }); return (
diff --git a/types/next-auth.d.ts b/types/next-auth.d.ts index 1a86454f2..d5568532c 100644 --- a/types/next-auth.d.ts +++ b/types/next-auth.d.ts @@ -4,7 +4,7 @@ import 'next-auth/jwt'; declare module 'next-auth' { interface Session { user: { - store_id: number; + customer_id: number; token: string; user_email: string; user_nicename: string; @@ -13,7 +13,7 @@ declare module 'next-auth' { } interface User { - store_id: number; + customer_id: number; token: string; user_email: string; user_nicename: string; @@ -24,7 +24,7 @@ declare module 'next-auth' { declare module 'next-auth/jwt' { interface JWT { user: { - store_id: number; + customer_id: number; token: string; user_email: string; user_nicename: string;