feat: Edit campaigns (#2230)

* add edit campaign component
This commit is contained in:
Muhsin Keloth
2021-05-10 12:40:48 +05:30
committed by GitHub
parent 7f6abdc987
commit db31bfcee4
10 changed files with 321 additions and 11 deletions
@@ -42,6 +42,17 @@ export const actions = {
commit(types.SET_CAMPAIGN_UI_FLAG, { isCreating: false });
}
},
update: async ({ commit }, { id, ...updateObj }) => {
commit(types.SET_CAMPAIGN_UI_FLAG, { isUpdating: true });
try {
const response = await CampaignsAPI.update(id, updateObj);
commit(types.EDIT_CAMPAIGN, response.data);
} catch (error) {
throw new Error(error);
} finally {
commit(types.SET_CAMPAIGN_UI_FLAG, { isUpdating: false });
}
},
};
export const mutations = {
@@ -54,6 +65,7 @@ export const mutations = {
[types.ADD_CAMPAIGN]: MutationHelpers.create,
[types.SET_CAMPAIGNS]: MutationHelpers.set,
[types.EDIT_CAMPAIGN]: MutationHelpers.update,
};
export default {