feat(dashboard): add promotions to campaign UI (#7283)
* feat(core-flows,types,medusa): API to add promotions to campaign * chore: consolidate specs * chore: split workflows step into 2 * chore: fix tests * chore: fix specs * chore: add promotions to campaign UI * chore: fix bug wrt to not refreshing * chore: address review comments
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
AdminCampaignListResponse,
|
||||
AdminCampaignResponse,
|
||||
CreateCampaignDTO,
|
||||
LinkMethodRequest,
|
||||
UpdateCampaignDTO,
|
||||
} from "@medusajs/types"
|
||||
import { CampaignDeleteRes } from "../../types/api-responses"
|
||||
@@ -27,10 +28,21 @@ async function deleteCampaign(id: string) {
|
||||
return deleteRequest<CampaignDeleteRes>(`/admin/campaigns/${id}`)
|
||||
}
|
||||
|
||||
async function addOrRemoveCampaignPromotions(
|
||||
id: string,
|
||||
payload: LinkMethodRequest
|
||||
) {
|
||||
return postRequest<AdminCampaignResponse>(
|
||||
`/admin/campaigns/${id}/promotions`,
|
||||
payload
|
||||
)
|
||||
}
|
||||
|
||||
export const campaigns = {
|
||||
retrieve: retrieveCampaign,
|
||||
list: listCampaigns,
|
||||
create: createCampaign,
|
||||
update: updateCampaign,
|
||||
delete: deleteCampaign,
|
||||
addOrRemovePromotions: addOrRemoveCampaignPromotions,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user