mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
89ab7fac25
commit
c24d532608
403 changed files with 23959 additions and 19557 deletions
|
@ -1,10 +1,9 @@
|
|||
import { computed, reactive, ref } from "@nuxtjs/composition-api";
|
||||
import { useStoreActions } from "./partials/use-actions-factory";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
import { GroupRecipeActionOut, GroupRecipeActionType } from "~/lib/api/types/household";
|
||||
import { RequestResponse } from "~/lib/api/types/non-generated";
|
||||
import { Recipe } from "~/lib/api/types/recipe";
|
||||
import { useScaledAmount } from "~/composables/recipes/use-scaled-amount";
|
||||
import type { GroupRecipeActionOut, GroupRecipeActionType } from "~/lib/api/types/household";
|
||||
import type { RequestResponse } from "~/lib/api/types/non-generated";
|
||||
import type { Recipe } from "~/lib/api/types/recipe";
|
||||
|
||||
const groupRecipeActions = ref<GroupRecipeActionOut[] | null>(null);
|
||||
const loading = ref(false);
|
||||
|
@ -31,8 +30,8 @@ export function useGroupRecipeActionData() {
|
|||
}
|
||||
|
||||
export const useGroupRecipeActions = function (
|
||||
orderBy: string | null = "title",
|
||||
orderDirection: string | null = "asc",
|
||||
orderBy: string | null = "title",
|
||||
orderDirection: string | null = "asc",
|
||||
) {
|
||||
const api = useUserApi();
|
||||
|
||||
|
@ -51,17 +50,16 @@ export const useGroupRecipeActions = function (
|
|||
const recipeServings = (recipe.recipeServings || 1) * recipeScale;
|
||||
const recipeYieldQuantity = (recipe.recipeYieldQuantity || 1) * recipeScale;
|
||||
|
||||
/* eslint-disable no-template-curly-in-string */
|
||||
return url
|
||||
.replace("${url}", window.location.href)
|
||||
.replace("${id}", recipe.id || "")
|
||||
.replace("${slug}", recipe.slug || "")
|
||||
.replace("${servings}", recipeServings.toString())
|
||||
.replace("${yieldQuantity}", recipeYieldQuantity.toString())
|
||||
.replace("${yieldText}", recipe.recipeYield || "")
|
||||
/* eslint-enable no-template-curly-in-string */
|
||||
.replace("${yieldText}", recipe.recipeYield || "");
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
||||
async function execute(action: GroupRecipeActionOut, recipe: Recipe, recipeScale: number): Promise<void | RequestResponse<unknown>> {
|
||||
const url = parseRecipeActionUrl(action.url, recipe, recipeScale);
|
||||
|
||||
|
@ -84,8 +82,8 @@ export const useGroupRecipeActions = function (
|
|||
...useStoreActions<GroupRecipeActionOut>(api.groupRecipeActions, groupRecipeActions, loading),
|
||||
flushStore() {
|
||||
groupRecipeActions.value = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
actions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue