mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 12:05:21 +02:00
hotfix: run fetch client side only
This commit is contained in:
parent
13e157827c
commit
960378b213
1 changed files with 8 additions and 6 deletions
|
@ -1,11 +1,13 @@
|
||||||
import { Ref, useAsync } from "@nuxtjs/composition-api";
|
import { onMounted, ref, Ref } from "@nuxtjs/composition-api";
|
||||||
import { useAsyncKey } from "../use-utils";
|
|
||||||
import { AppInfo } from "~/types/api-types/admin";
|
import { AppInfo } from "~/types/api-types/admin";
|
||||||
|
|
||||||
export function useAppInfo(): Ref<AppInfo | null> {
|
export function useAppInfo(): Ref<AppInfo | null> {
|
||||||
return useAsync(async () => {
|
const appInfo = ref<null | AppInfo>(null);
|
||||||
// We use fetch here to reduce need for additional dependencies
|
|
||||||
|
onMounted(async () => {
|
||||||
const data = await fetch("/api/app/about").then((res) => res.json());
|
const data = await fetch("/api/app/about").then((res) => res.json());
|
||||||
return data as AppInfo;
|
appInfo.value = data as AppInfo;
|
||||||
}, useAsyncKey());
|
});
|
||||||
|
|
||||||
|
return appInfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue