docs: various improvements to introduction guides (#14398)

This commit is contained in:
Shahed Nasser
2025-12-24 15:37:37 +02:00
committed by GitHub
parent 10dab3a47a
commit ba3a572a89
9 changed files with 61 additions and 53 deletions
@@ -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",