feat: customer groups react hooks (#1153)

* fix: msw handlers for medusa-react storybook

* feat: add customer groups query hooks

* feat: add create/update customer groups hooks

* feat: add customer group batch  hooks

* feat: add test files, fix import

* add customer groups fixture

* add customer gorup mock endpoints

* add test cases

* add hook comments

* fix: typos

* fix: comments refactor

* fix: comment

Co-authored-by: fPolic <frane@medusajs.com>
This commit is contained in:
Frane Polić
2022-03-07 12:52:48 +01:00
committed by GitHub
co-authored by fPolic
parent a6f352d9f1
commit daf49bcaf3
11 changed files with 335 additions and 8 deletions
@@ -509,6 +509,48 @@ export const adminHandlers = [
)
}),
rest.get("/admin/customer-groups/", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
customer_groups: fixtures.list("customer_group"),
})
)
}),
rest.get("/admin/customer-groups/:id", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
customer_group: fixtures.get("customer_group"),
})
)
}),
rest.post("/admin/customer-groups/", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
customer_group: {
...fixtures.get("customer_group"),
...(req.body as any),
},
})
)
}),
rest.post("/admin/customer-groups/:id", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
customer_group: {
...fixtures.get("customer_group"),
...(req.body as any),
},
})
)
}),
rest.get("/admin/discounts/", (req, res, ctx) => {
return res(
ctx.status(200),