docs: update docs across projects following publishable API key change in store routes (#9098)

* docs: update docs across projects following publishable API key change in store routes

* rename env variable

* move subscribe route out of store
This commit is contained in:
Shahed Nasser
2024-09-16 16:42:08 +03:00
committed by GitHub
parent ef8dc4087e
commit 58f06be44d
66 changed files with 577 additions and 298 deletions
@@ -19,7 +19,7 @@ export const highlights = [
["14", "throwOnError", "Specify that errors occuring during the workflow's execution should be returned, not thrown."],
]
```ts title="src/api/store/workflows/route.ts" highlights={highlights} collapsibleLines="1-6" expandButtonLabel="Show Imports"
```ts title="src/api/workflows/route.ts" highlights={highlights} collapsibleLines="1-6" expandButtonLabel="Show Imports"
import type {
MedusaRequest,
MedusaResponse,
@@ -239,9 +239,9 @@ In the workflow construction function, you first run the `updateProduct` step, t
You can now use and execute your workflow in your Medusa application.
To execute the workflow in an API route, create the file `src/api/store/products/[id]/erp/route.ts` with the following content:
To execute the workflow in an API route, create the file `src/api/products/[id]/erp/route.ts` with the following content:
```ts title="src/api/store/products/[id]/erp/route.ts"
```ts title="src/api/products/[id]/erp/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import updateProductAndErpWorkflow, {
UpdateProductAndErpWorkflowInput,
@@ -79,7 +79,7 @@ export default myWorkflow
3. Execute the workflow from a resource, such as an API route:
```ts title="src/api/store/workflow/route.ts" collapsibleLines="1-6" expandButtonLabel="Show Imports"
```ts title="src/api/workflow/route.ts" collapsibleLines="1-6" expandButtonLabel="Show Imports"
import type {
MedusaRequest,
MedusaResponse,
@@ -103,10 +103,10 @@ export async function GET(
npm run dev
```
5. Send a `GET` request to `/store/workflow`:
5. Send a `GET` request to `/workflow`:
```bash apiTesting testApiMethod="GET" testApiUrl="http://localhost:9000/store/workflow"
curl http://localhost:9000/store/workflow
```bash
curl http://localhost:9000/workflow
```
In the console, you'll see:
@@ -276,7 +276,7 @@ export const highlights = [
["30", "subscribe", "Subscribe to status changes of the workflow execution."],
]
```ts title="src/api/store/workflows/route.ts" highlights={highlights} collapsibleLines="1-11" expandButtonLabel="Show Imports"
```ts title="src/api/workflows/route.ts" highlights={highlights} collapsibleLines="1-11" expandButtonLabel="Show Imports"
import type { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import myWorkflow from "../../../workflows/hello-world"
import {