feat: Add the ability add new portal (#5219)

This commit is contained in:
Muhsin Keloth
2022-08-10 09:27:52 +05:30
committed by GitHub
parent 657bd44418
commit 16ad263a3a
8 changed files with 278 additions and 8 deletions

View File

@@ -26,13 +26,20 @@ export const actions = {
}
},
create: async ({ commit }, params) => {
create: async ({ commit, state, dispatch }, params) => {
commit(types.SET_UI_FLAG, { isCreating: true });
try {
const { data } = await portalAPIs.create(params);
const { id: portalId } = data;
commit(types.ADD_PORTAL_ENTRY, data);
commit(types.ADD_PORTAL_ID, portalId);
const {
portals: { selectedPortalId },
} = state;
// Check if there are any selected portal
if (!selectedPortalId) {
dispatch('setPortalId', portalId);
}
} catch (error) {
throwErrorMessage(error);
} finally {