Commit b244efc5 authored by Tim Zallmann's avatar Tim Zallmann

Changed fetchLabel to take options object

parent 13b227a9
...@@ -20,8 +20,8 @@ export const receiveLabelsFailure = ({ commit }) => { ...@@ -20,8 +20,8 @@ export const receiveLabelsFailure = ({ commit }) => {
message: __('Error fetching labels.'), message: __('Error fetching labels.'),
}); });
}; };
export const fetchLabels = ({ state, dispatch }, enforce) => { export const fetchLabels = ({ state, dispatch }, options) => {
if (!enforce && state.labelsFetched) { if (state.labelsFetched && (!options || !options.refetch)) {
return Promise.resolve(); return Promise.resolve();
} }
...@@ -50,7 +50,7 @@ export const createLabel = ({ state, dispatch }, label) => { ...@@ -50,7 +50,7 @@ export const createLabel = ({ state, dispatch }, label) => {
}) })
.then(({ data }) => { .then(({ data }) => {
if (data.id) { if (data.id) {
dispatch('fetchLabels', true); dispatch('fetchLabels', { refetch: true });
dispatch('receiveCreateLabelSuccess'); dispatch('receiveCreateLabelSuccess');
dispatch('toggleDropdownContentsCreateView'); dispatch('toggleDropdownContentsCreateView');
} else { } else {
......
...@@ -225,7 +225,7 @@ describe('LabelsSelect Actions', () => { ...@@ -225,7 +225,7 @@ describe('LabelsSelect Actions', () => {
[], [],
[ [
{ type: 'requestCreateLabel' }, { type: 'requestCreateLabel' },
{ payload: true, type: 'fetchLabels' }, { payload: { refetch: true }, type: 'fetchLabels' },
{ type: 'receiveCreateLabelSuccess' }, { type: 'receiveCreateLabelSuccess' },
{ type: 'toggleDropdownContentsCreateView' }, { type: 'toggleDropdownContentsCreateView' },
], ],
......
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