Skip to content

Commit

Permalink
getAll if array is empty or non existant (#3120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuchenpirat committed Feb 5, 2024
1 parent 8a31730 commit 13e7dfe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frontend/composables/store/use-food-store.ts
Expand Up @@ -43,7 +43,7 @@ export const usePublicFoodStore = function (groupSlug: string) {
},
};

if (!foodStore.value) {
if (!foodStore.value || foodStore.value.length === 0) {
foodStore = actions.getAll();
}

Expand All @@ -61,7 +61,7 @@ export const useFoodStore = function () {
},
};

if (!foodStore) {
if (!foodStore.value || foodStore.value.length === 0) {
foodStore = actions.getAll();
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/composables/store/use-label-store.ts
Expand Up @@ -33,11 +33,11 @@ export function useLabelStore() {
const actions = {
...useStoreActions<MultiPurposeLabelOut>(api.multiPurposeLabels, labelStore, loading),
flushStore() {
labelStore.value =[];
labelStore.value = [];
},
};

if (!labelStore.value) {
if (!labelStore.value || labelStore.value?.length === 0) {
labelStore = actions.getAll();
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/composables/store/use-unit-store.ts
Expand Up @@ -44,7 +44,7 @@ export const useUnitStore = function () {
},
};

if (!unitStore.value) {
if (!unitStore.value || unitStore.value.length === 0) {
unitStore = actions.getAll();
}

Expand Down

0 comments on commit 13e7dfe

Please sign in to comment.