Feat(medusa-js, medusa-react): Upload endpoints in medusa js and react (#1716)

* export types from admin uploads

* add delete and download to medusa-js

* add upload endpoints to hooks

* remove upload from js and react

* pr feedback

* Apply suggestions from code review

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>

* rename types for admin uploads

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Philip KorsholmandOliver Windall Juhl authored and GitHub committed 2022-06-29 11:36:19 +02:00
1 parent bf47d1aecd
commit 9018d270be
11 files changed
+187 -25

No files matched your search

@@ -1,4 +1,5 @@
import { rest } from "msw"
import { body } from "msw/lib/types/context"
import { fixtures } from "../data"
export const adminHandlers = [
@@ -1651,4 +1652,24 @@ export const adminHandlers = [
rest.delete("/admin/auth", (req, res, ctx) => {
return res(ctx.status(200))
}),
rest.delete("/admin/uploads", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
id: (req.body as any).file_key,
object: "file",
deleted: true,
})
)
}),
rest.post("/admin/uploads/download-url", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
download_url: fixtures.get("upload").url,
})
)
}),
]