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:
Riqwan Thamir
2024-05-10 10:39:01 +02:00
committed by GitHub
parent ea872cbda9
commit 6ec5ded6c8
13 changed files with 374 additions and 24 deletions

View File

@@ -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,
}