docs: various improvements to introduction guides (#14398)
This commit is contained in:
@@ -71,11 +71,12 @@ To fetch data with a route loader:
|
||||
For example, consider the following UI route created at `src/admin/routes/custom/page.tsx`:
|
||||
|
||||
export const loaderHighlights = [
|
||||
["6", "loader", "Export a loader function to fetch products."],
|
||||
["15", "useLoaderData", "Access the data returned by the loader function in the route component."],
|
||||
["7", "loader", "Export a loader function to fetch products."],
|
||||
["16", "useLoaderData", "Access the data returned by the loader function in the route component."],
|
||||
]
|
||||
|
||||
```tsx title="src/admin/routes/custom/page.tsx" highlights={loaderHighlights}
|
||||
import { defineRouteConfig } from "@medusajs/admin-sdk"
|
||||
import { Container, Heading } from "@medusajs/ui"
|
||||
import {
|
||||
useLoaderData,
|
||||
|
||||
@@ -42,6 +42,7 @@ export const sdk = new Medusa({
|
||||
import Medusa from "@medusajs/js-sdk"
|
||||
|
||||
export const sdk = new Medusa({
|
||||
// add __BACKEND_URL__ to src/admin/vite-env.d.ts if you get type errors
|
||||
baseUrl: __BACKEND_URL__ || "/",
|
||||
auth: {
|
||||
type: "session",
|
||||
|
||||
Reference in New Issue
Block a user