swaps in admin resources (#928)
This commit is contained in:
@@ -7,7 +7,9 @@ import AdminDraftOrdersResource from "./draft-orders"
|
|||||||
import AdminGiftCardsResource from "./gift-cards"
|
import AdminGiftCardsResource from "./gift-cards"
|
||||||
import AdminInvitesResource from "./invites"
|
import AdminInvitesResource from "./invites"
|
||||||
import AdminNotesResource from "./notes"
|
import AdminNotesResource from "./notes"
|
||||||
|
import AdminSwapsResource from "./swaps"
|
||||||
import AdminShippingProfilesResource from "./shipping-profiles"
|
import AdminShippingProfilesResource from "./shipping-profiles"
|
||||||
|
|
||||||
class Admin extends BaseResource {
|
class Admin extends BaseResource {
|
||||||
public auth = new AdminAuthResource(this.client)
|
public auth = new AdminAuthResource(this.client)
|
||||||
public customers = new AdminCustomersResource(this.client)
|
public customers = new AdminCustomersResource(this.client)
|
||||||
@@ -17,6 +19,7 @@ class Admin extends BaseResource {
|
|||||||
public giftCards = new AdminGiftCardsResource(this.client)
|
public giftCards = new AdminGiftCardsResource(this.client)
|
||||||
public invites = new AdminInvitesResource(this.client)
|
public invites = new AdminInvitesResource(this.client)
|
||||||
public notes = new AdminNotesResource(this.client)
|
public notes = new AdminNotesResource(this.client)
|
||||||
|
public swaps = new AdminSwapsResource(this.client)
|
||||||
public shippingProfiles = new AdminShippingProfilesResource(this.client)
|
public shippingProfiles = new AdminShippingProfilesResource(this.client)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import {
|
||||||
|
AdminSwapsRes,
|
||||||
|
AdminSwapsListRes,
|
||||||
|
AdminGetSwapsParams,
|
||||||
|
} from "@medusajs/medusa"
|
||||||
|
import { ResponsePromise } from "../../typings"
|
||||||
|
import BaseResource from "../base"
|
||||||
|
|
||||||
|
class AdminSwapsResource extends BaseResource {
|
||||||
|
retrieve(id: string): ResponsePromise<AdminSwapsRes> {
|
||||||
|
const path = `/admin/swaps/${id}`
|
||||||
|
return this.client.request("GET", path)
|
||||||
|
}
|
||||||
|
|
||||||
|
list(query: AdminGetSwapsParams): ResponsePromise<AdminSwapsListRes> {
|
||||||
|
let path = `/admin/swaps/`
|
||||||
|
|
||||||
|
if (query) {
|
||||||
|
const queryString = Object.entries(query).map(([key, value]) => {
|
||||||
|
return `${key}=${value}`
|
||||||
|
})
|
||||||
|
|
||||||
|
path = `/admin/swaps?${queryString.join("&")}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.client.request("GET", path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AdminSwapsResource
|
||||||
@@ -28,6 +28,7 @@ export * from "./routes/admin/notifications"
|
|||||||
export * from "./routes/admin/shipping-profiles"
|
export * from "./routes/admin/shipping-profiles"
|
||||||
export * from "./routes/admin/store"
|
export * from "./routes/admin/store"
|
||||||
export * from "./routes/admin/variants"
|
export * from "./routes/admin/variants"
|
||||||
|
export * from "./routes/admin/swaps"
|
||||||
// Store
|
// Store
|
||||||
export * from "./routes/store/auth"
|
export * from "./routes/store/auth"
|
||||||
export * from "./routes/store/carts"
|
export * from "./routes/store/carts"
|
||||||
|
|||||||
Reference in New Issue
Block a user