feat(medusa-js,medusa-react,medusa): Add missing Currency endpoints (#2185)
This commit is contained in:
1 parent
b6161d2404
commit
64949dc721
13 files changed
+233
-17
No files matched your search
@@ -1,5 +1,12 @@
|
||||
{
|
||||
"resources": {
|
||||
"currency": {
|
||||
"symbol": "$",
|
||||
"name": "US Dollar",
|
||||
"symbol_native": "$",
|
||||
"code": "USD",
|
||||
"includes_tax": false
|
||||
},
|
||||
"region": {
|
||||
"id": "reg_01F0YES4R67TXXC1QBQ8P54A8Y",
|
||||
"name": "Test Region",
|
||||
@@ -1271,14 +1278,16 @@
|
||||
"created_at": "2022-07-05T15:16:01.959Z",
|
||||
"deleted_at": null
|
||||
},
|
||||
"sales_channels": [{
|
||||
"id": "sc_01F0YES4R67TXXC1QBQ8P54A8Y",
|
||||
"name": "sales channel 1 name",
|
||||
"description": "sales channel 1 description",
|
||||
"is_disabled": false,
|
||||
"updated_at": "2022-07-05T15:16:01.959Z",
|
||||
"created_at": "2022-07-05T15:16:01.959Z",
|
||||
"deleted_at": null
|
||||
}]
|
||||
"sales_channels": [
|
||||
{
|
||||
"id": "sc_01F0YES4R67TXXC1QBQ8P54A8Y",
|
||||
"name": "sales channel 1 name",
|
||||
"description": "sales channel 1 description",
|
||||
"is_disabled": false,
|
||||
"updated_at": "2022-07-05T15:16:01.959Z",
|
||||
"created_at": "2022-07-05T15:16:01.959Z",
|
||||
"deleted_at": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import { rest } from "msw"
|
||||
import { body } from "msw/lib/types/context"
|
||||
import { fixtures } from "../data"
|
||||
|
||||
export const adminHandlers = [
|
||||
@@ -114,8 +113,8 @@ export const adminHandlers = [
|
||||
ctx.json({
|
||||
collection: {
|
||||
...fixtures.get("product_collection"),
|
||||
products: [fixtures.get("product")]
|
||||
}
|
||||
products: [fixtures.get("product")],
|
||||
},
|
||||
})
|
||||
)
|
||||
}),
|
||||
@@ -126,7 +125,7 @@ export const adminHandlers = [
|
||||
ctx.json({
|
||||
id: req.params.id,
|
||||
object: "product-collection",
|
||||
removed_products: [fixtures.get("product").id]
|
||||
removed_products: [fixtures.get("product").id],
|
||||
})
|
||||
)
|
||||
}),
|
||||
@@ -892,7 +891,7 @@ export const adminHandlers = [
|
||||
discount_condition: {
|
||||
...fixtures
|
||||
.get("discount")
|
||||
.rule.conditions.find(c => c.id === req.params.conditionId),
|
||||
.rule.conditions.find((c) => c.id === req.params.conditionId),
|
||||
},
|
||||
})
|
||||
)
|
||||
@@ -1767,4 +1766,25 @@ export const adminHandlers = [
|
||||
})
|
||||
)
|
||||
}),
|
||||
|
||||
rest.get("/admin/currencies", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
count: 1,
|
||||
limit: 20,
|
||||
offset: 20,
|
||||
currencies: fixtures.list("currency", 1),
|
||||
})
|
||||
)
|
||||
}),
|
||||
|
||||
rest.post("/admin/currencies/:code", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
currency: { ...fixtures.get("currency"), ...(req.body as any) },
|
||||
})
|
||||
)
|
||||
}),
|
||||
]
|
||||
Reference in new issue
Block a user