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