diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx index 0023029..5df0f8e 100644 --- a/src/app/account/page.tsx +++ b/src/app/account/page.tsx @@ -1,42 +1,36 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import React from 'react'; -import { getUser } from '@/auth'; -import { redirect } from 'next/navigation'; -import signOut from '@/lib/actions/signOut'; import { Label } from '@/components/ui/label'; import { Input } from '@/components/ui/input'; -import { URL_SIGN_IN } from '@/lib/constants'; import generateSampleData from '@/lib/actions/generateSampleData'; import prisma from '@/prisma'; import { ServerActionTrigger } from '@/components/form/serverActionTrigger'; import accountDelete from '@/lib/actions/accountDelete'; +import { Button } from '@/components/ui/button'; +import { getSession, Session } from '@auth0/nextjs-auth0'; export default async function AccountPage() { - const user = await getUser(); - - if (!user) { - redirect(URL_SIGN_IN); - } + const {user} = await getSession() as Session; let paymentCount = 0; paymentCount = await prisma.payment.count({ where: { - userId: user.id, + userId: user.sub, }, }); let entityCount = 0; entityCount = await prisma.entity.count({ where: { - userId: user.id, + userId: user.sub, }, }); let categoryCount = 0; categoryCount = await prisma.category.count({ where: { - userId: user.id, + userId: user.sub, }, }); @@ -44,7 +38,7 @@ export default async function AccountPage() {