mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
feat: Filter Recipes By Household (and a ton of bug fixes) (#4207)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
2a6922a85c
commit
7c274de778
65 changed files with 896 additions and 590 deletions
|
@ -1,50 +1,21 @@
|
|||
import { reactive, ref, Ref } from "@nuxtjs/composition-api";
|
||||
import { useStoreActions } from "../partials/use-actions-factory";
|
||||
import { ref, Ref } from "@nuxtjs/composition-api";
|
||||
import { useData, useStore } from "../partials/use-store-factory";
|
||||
import { MultiPurposeLabelOut } from "~/lib/api/types/labels";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
|
||||
let labelStore: Ref<MultiPurposeLabelOut[] | null> = ref([]);
|
||||
const storeLoading = ref(false);
|
||||
const store: Ref<MultiPurposeLabelOut[]> = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
export function useLabelData() {
|
||||
const data = reactive({
|
||||
export const useLabelData = function () {
|
||||
return useData<MultiPurposeLabelOut>({
|
||||
groupId: "",
|
||||
id: "",
|
||||
name: "",
|
||||
color: "",
|
||||
});
|
||||
|
||||
function reset() {
|
||||
data.groupId = "";
|
||||
data.id = "";
|
||||
data.name = "";
|
||||
data.color = "";
|
||||
}
|
||||
|
||||
return {
|
||||
data,
|
||||
reset,
|
||||
};
|
||||
}
|
||||
|
||||
export function useLabelStore() {
|
||||
export const useLabelStore = function () {
|
||||
const api = useUserApi();
|
||||
const loading = storeLoading;
|
||||
|
||||
const actions = {
|
||||
...useStoreActions<MultiPurposeLabelOut>(api.multiPurposeLabels, labelStore, loading),
|
||||
flushStore() {
|
||||
labelStore.value = [];
|
||||
},
|
||||
};
|
||||
|
||||
if (!loading.value && (!labelStore.value || labelStore.value?.length === 0)) {
|
||||
labelStore = actions.getAll();
|
||||
}
|
||||
|
||||
return {
|
||||
labels: labelStore,
|
||||
actions,
|
||||
loading,
|
||||
};
|
||||
return useStore<MultiPurposeLabelOut>(store, loading, api.multiPurposeLabels);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue