Skip to content

Commit

Permalink
fixed : stuck loading screen on guest user
Browse files Browse the repository at this point in the history
  • Loading branch information
hellp002 committed Oct 28, 2023
1 parent 96fd101 commit 9b12f09
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/product/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ export default async function Page({ params }: { params: { id: string } }) {

},
}));
if (!is_reviewable || !user) return <div> Loading ....</div>
const prev_review = await db.review.findFirst({
if (is_reviewable === null) return <div>Loading ...</div>

const prev_review = (!user) ? null : ( await db.review.findFirst({
where : {
productId : id,
userId : user.id as string
}
})

}))
console.log(prev_review)
const is_reviewables : Cascade_review[] = is_reviewable.reviews
const data = await db.product.findFirst({
where: {
Expand Down Expand Up @@ -176,7 +177,7 @@ export default async function Page({ params }: { params: { id: string } }) {
<Card className="w-full">
<CardHeader className="">
<div className="items-center flex justify-center">Review section</div>
<ReviewForm productId={id} prev_review={prev_review}/>
{(isAuthenticated()) ? (<ReviewForm productId={id} prev_review={prev_review}/> ): (<></>)}
</CardHeader>
</Card>

Expand Down

0 comments on commit 9b12f09

Please sign in to comment.