Skip to content

Commit

Permalink
chore: changes shop pages to use new next 15 params api
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanHjelsethStorstad committed Jan 31, 2025
1 parent d40d00f commit edde355
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 3cc94e to 97b8ef
14 changes: 7 additions & 7 deletions src/app/admin/product/[productId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { v4 as uuid } from 'uuid'
import Link from 'next/link'
import { displayPrice } from '@/lib/money/convert'

export default async function ProductPage({
params
}: {
params: {
type PropTypes = {
params: Promise<{
productId: number
}
}) {
const product = unwrapActionReturn(await readProductAction({ productId: Number(params.productId) }))
}>
}

export default async function ProductPage({ params }: PropTypes) {
const product = unwrapActionReturn(await readProductAction({ productId: Number((await params).productId) }))

return <PageWrapper
title={product.name}
Expand Down
12 changes: 7 additions & 5 deletions src/app/admin/shop/[shop]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { notFound } from 'next/navigation'
import { v4 as uuid } from 'uuid'
import type { Product } from '@prisma/client'

export default async function Shop(params: {
params: {
type PropTypes = {
params: Promise<{
shop: string
}
}) {
const shopId = parseInt(params.params.shop, 10)
}>
}

export default async function Shop({ params }: PropTypes) {
const shopId = parseInt((await params).shop, 10)
if (isNaN(shopId)) notFound()

const shopData = unwrapActionReturn(await readShopAction({
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/shop/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Link from 'next/link'
import { v4 as uuid } from 'uuid'


export default async function Shop() {
export default async function Shops() {
const shops = unwrapActionReturn(await readShopsAction())

return <PageWrapper
Expand Down

0 comments on commit edde355

Please sign in to comment.