1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

hotfix: run fetch client side only

This commit is contained in:
Hayden 2022-03-15 19:31:45 -08:00
parent 13e157827c
commit 960378b213

View file

@ -1,11 +1,13 @@
import { Ref, useAsync } from "@nuxtjs/composition-api";
import { useAsyncKey } from "../use-utils";
import { onMounted, ref, Ref } from "@nuxtjs/composition-api";
import { AppInfo } from "~/types/api-types/admin";
export function useAppInfo(): Ref<AppInfo | null> {
return useAsync(async () => {
// We use fetch here to reduce need for additional dependencies
const appInfo = ref<null | AppInfo>(null);
onMounted(async () => {
const data = await fetch("/api/app/about").then((res) => res.json());
return data as AppInfo;
}, useAsyncKey());
appInfo.value = data as AppInfo;
});
return appInfo;
}