Remove loadManagedLicensesError state property

This removes the loadManagedLicensesError property from the license management store.
This property isn't used anywhere, so it does not make sense to keep
maintaining it and the associated actions and mutations.
parent 04bbe17f
......@@ -55,8 +55,8 @@ export const requestManagedLicenses = ({ commit }) => {
export const receiveManagedLicensesSuccess = ({ commit }, licenses) => {
commit(types.RECEIVE_MANAGED_LICENSES_SUCCESS, licenses);
};
export const receiveManagedLicensesError = ({ commit }, error) => {
commit(types.RECEIVE_MANAGED_LICENSES_ERROR, error);
export const receiveManagedLicensesError = ({ commit }) => {
commit(types.RECEIVE_MANAGED_LICENSES_ERROR);
};
export const fetchManagedLicenses = ({ dispatch, state }) => {
dispatch('requestManagedLicenses');
......@@ -68,8 +68,8 @@ export const fetchManagedLicenses = ({ dispatch, state }) => {
.then(({ data }) => {
dispatch('receiveManagedLicensesSuccess', data);
})
.catch((error) => {
dispatch('receiveManagedLicensesError', error);
.catch(() => {
dispatch('receiveManagedLicensesError');
});
};
......
......@@ -31,14 +31,12 @@ export default {
Object.assign(state, {
managedLicenses,
isLoadingManagedLicenses: false,
loadManagedLicensesError: false,
});
},
[types.RECEIVE_MANAGED_LICENSES_ERROR](state, error) {
[types.RECEIVE_MANAGED_LICENSES_ERROR](state) {
Object.assign(state, {
managedLicenses: [],
isLoadingManagedLicenses: false,
loadManagedLicensesError: error,
});
},
[types.REQUEST_MANAGED_LICENSES](state) {
......
......@@ -9,7 +9,6 @@ export default () => ({
isLoadingManagedLicenses: false,
pendingLicenses: [],
loadLicenseReportError: false,
loadManagedLicensesError: false,
managedLicenses: [],
newLicenses: [],
existingLicenses: [],
......
......@@ -414,7 +414,7 @@ describe('License store actions', () => {
actions.receiveManagedLicensesError,
error,
state,
[{ type: mutationTypes.RECEIVE_MANAGED_LICENSES_ERROR, payload: error }],
[{ type: mutationTypes.RECEIVE_MANAGED_LICENSES_ERROR }],
[],
)
.then(done)
......@@ -452,10 +452,7 @@ describe('License store actions', () => {
null,
state,
[],
[
{ type: 'requestManagedLicenses' },
{ type: 'receiveManagedLicensesError', payload: expect.any(Error) },
],
[{ type: 'requestManagedLicenses' }, { type: 'receiveManagedLicensesError' }],
)
.then(done)
.catch(done.fail);
......
......@@ -177,13 +177,12 @@ describe('License store mutations', () => {
});
describe('RECEIVE_MANAGED_LICENSES_SUCCESS', () => {
it('sets isLoadingManagedLicenses and loadManagedLicensesError to false and saves managed licenses', () => {
it('sets isLoadingManagedLicenses to false and saves managed licenses', () => {
store.replaceState({
...store.state,
licenseManagement: {
managedLicenses: false,
isLoadingManagedLicenses: true,
loadManagedLicensesError: true,
},
});
......@@ -196,7 +195,6 @@ describe('License store mutations', () => {
]);
expect(store.state.licenseManagement.isLoadingManagedLicenses).toBe(false);
expect(store.state.licenseManagement.loadManagedLicensesError).toBe(false);
});
});
......@@ -207,14 +205,12 @@ describe('License store mutations', () => {
...store.state,
licenseManagement: {
isLoadingManagedLicenses: true,
loadManagedLicensesError: false,
},
});
store.commit(`licenseManagement/${types.RECEIVE_MANAGED_LICENSES_ERROR}`, error);
expect(store.state.licenseManagement.isLoadingManagedLicenses).toBe(false);
expect(store.state.licenseManagement.loadManagedLicensesError).toBe(error);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment