docs: update storefront development snippets for next.js 15 compatibility (#10843)
This commit is contained in:
@@ -53,8 +53,8 @@ export const fetchHighlights = [
|
||||
export const highlights = [
|
||||
["20", "offset", "Calculate the number of addresses to skip based on the current page and limit."],
|
||||
["27", "fetch", "Send a request to retrieve the addresses."],
|
||||
["31", "searchParams.toString()", "Pass the pagination parameters in the query."],
|
||||
["34", "count", "The total number of addresses in the Medusa application."],
|
||||
["28", "searchParams.toString()", "Pass the pagination parameters in the query."],
|
||||
["36", "count", "The total number of addresses in the Medusa application."],
|
||||
["48", "setHasMorePages", "Set whether there are more pages based on the total count."],
|
||||
["62", "", "Using only two address fields for simplicity."],
|
||||
["68", "button", "Show a button to load more addresses if there are more pages."]
|
||||
@@ -379,11 +379,10 @@ To edit an address, send a request to the [Update Customer Address API route](!a
|
||||
export const editHighlights = [
|
||||
["4", "useRegion", "Use the hook defined in the Region Context guide."],
|
||||
["5", "useCustomer", "Use the hook defined in the Customer Context guide."],
|
||||
["14", "{ params: { id }}", "This is based on Next.js which passes the path parameters as a prop."],
|
||||
["19", "address", "Retrieve the address from the customer's `addresses` property."],
|
||||
["60"], ["61"], ["62"], ["63"], ["64"], ["65"], ["66"], ["67"], ["68"], ["69"],
|
||||
["70"], ["71"], ["72"], ["73"], ["74"], ["75"], ["76"], ["77"], ["78"], ["79"],
|
||||
["80"], ["81"], ["82"]
|
||||
["17", "address", "Retrieve the address from the customer's `addresses` property."],
|
||||
["58"], ["59"], ["60"], ["61"], ["62"], ["63"], ["64"], ["65"], ["66"], ["67"],
|
||||
["68"], ["69"], ["70"], ["71"], ["72"], ["73"], ["74"], ["75"], ["76"], ["77"],
|
||||
["78"], ["79"], ["80"]
|
||||
]
|
||||
|
||||
```tsx highlights={editHighlights} collapsibleLines="90-161" expandButtonLabel="Show form"
|
||||
@@ -393,14 +392,12 @@ export const editHighlights = [
|
||||
import { useRegion } from "../../../../../providers/region"
|
||||
import { useCustomer } from "../../../../../providers/customer"
|
||||
|
||||
type Params = {
|
||||
params: {
|
||||
id: string
|
||||
}
|
||||
type Props = {
|
||||
id: string
|
||||
}
|
||||
|
||||
export default function EditAddress(
|
||||
{ params: { id } }: Params
|
||||
{ id }: Props
|
||||
) {
|
||||
const { customer, setCustomer } = useCustomer()
|
||||
const { region } = useRegion()
|
||||
|
||||
@@ -8,7 +8,7 @@ tags:
|
||||
import { CodeTabs, CodeTab } from "docs-ui"
|
||||
|
||||
export const metadata = {
|
||||
title: `Retrieve Customer in Storefront`,
|
||||
title: `Retrieve Logged-In Customer in Storefront`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
@@ -392,7 +392,7 @@ export const validateReactHighlights = [
|
||||
["2", "sendCallback", "Validate the callback in Medusa and retrieve the authentication token"],
|
||||
["4", "shouldCreateCustomer", "Check if the decoded token has an `actor_id` property to decide whether a customer to be created."],
|
||||
["7", "createCustomer", "Create a customer if the decoded token doesn't have `actor_id`."],
|
||||
["9", "refetchToken", "Fetch a new token for the created customer."],
|
||||
["9", "refreshToken", "Fetch a new token for the created customer."],
|
||||
["13", "fetch", "Send an authenticated request using the token."]
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user