feat: Create portal UI improvements (#5261)
This commit is contained in:
@@ -49,12 +49,13 @@ export const actions = {
|
||||
|
||||
update: async ({ commit }, params) => {
|
||||
const portalId = params.id;
|
||||
const portalSlug = params.slug;
|
||||
commit(types.SET_HELP_PORTAL_UI_FLAG, {
|
||||
uiFlags: { isUpdating: true },
|
||||
portalId,
|
||||
});
|
||||
try {
|
||||
const { data } = await portalAPIs.update(params);
|
||||
const { data } = await portalAPIs.updatePortal({ portalSlug, params });
|
||||
commit(types.UPDATE_PORTAL_ENTRY, data);
|
||||
} catch (error) {
|
||||
throwErrorMessage(error);
|
||||
|
||||
@@ -41,7 +41,7 @@ export const mutations = {
|
||||
[types.CLEAR_PORTALS]: $state => {
|
||||
Vue.set($state.portals, 'byId', {});
|
||||
Vue.set($state.portals, 'allIds', []);
|
||||
Vue.set($state.portals, 'uiFlags', {});
|
||||
Vue.set($state.portals, 'uiFlags.byId', {});
|
||||
},
|
||||
|
||||
[types.SET_PORTALS_META]: ($state, data) => {
|
||||
|
||||
@@ -98,7 +98,11 @@ describe('#mutations', () => {
|
||||
mutations[types.CLEAR_PORTALS](state);
|
||||
expect(state.portals.allIds).toEqual([]);
|
||||
expect(state.portals.byId).toEqual({});
|
||||
expect(state.portals.uiFlags).toEqual({});
|
||||
expect(state.portals.uiFlags).toEqual({
|
||||
byId: {
|
||||
'1': { isFetching: true, isUpdating: true, isDeleting: false },
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user