1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +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:
Hoa (Kyle) Trinh 2025-06-20 00:09:12 +07:00 committed by GitHub
parent 89ab7fac25
commit c24d532608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
403 changed files with 23959 additions and 19557 deletions

View file

@ -1,9 +1,9 @@
import { useAsync, useRouter, ref } from "@nuxtjs/composition-api";
import { ref } from "vue";
import { useAsyncKey } from "../use-utils";
import { usePublicExploreApi } from "~/composables/api/api-client";
import { useUserApi } from "~/composables/api";
import { OrderByNullPosition, Recipe } from "~/lib/api/types/recipe";
import { RecipeSearchQuery } from "~/lib/api/user/recipes/recipe";
import type { OrderByNullPosition, Recipe } from "~/lib/api/types/recipe";
import type { RecipeSearchQuery } from "~/lib/api/user/recipes/recipe";
export const allRecipes = ref<Recipe[]>([]);
export const recentRecipes = ref<Recipe[]>([]);
@ -13,7 +13,7 @@ function getParams(
orderDirection = "desc",
orderByNullPosition: OrderByNullPosition | null = null,
query: RecipeSearchQuery | null = null,
queryFilter: string | null = null
queryFilter: string | null = null,
) {
return {
orderBy,
@ -53,7 +53,6 @@ export const useLazyRecipes = function (publicGroupSlug: string | null = null) {
query: RecipeSearchQuery | null = null,
queryFilter: string | null = null,
) {
const { data, error } = await api.recipes.getAll(
page,
perPage,
@ -113,7 +112,7 @@ export const useRecipes = (
fetchRecipes = true,
loadFood = false,
queryFilter: string | null = null,
publicGroupSlug: string | null = null
publicGroupSlug: string | null = null,
) => {
const api = publicGroupSlug ? usePublicExploreApi(publicGroupSlug).explore : useUserApi();
@ -125,7 +124,8 @@ export const useRecipes = (
page: 1,
perPage: -1,
};
} else {
}
else {
return {
recipes: recentRecipes,
page: 1,
@ -142,9 +142,9 @@ export const useRecipes = (
}
function getAllRecipes() {
useAsync(async () => {
useAsyncData(useAsyncKey(), async () => {
await refreshRecipes();
}, useAsyncKey());
});
}
function assignSorted(val: Array<Recipe>) {