1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-19 05:09:40 +02:00
mealie/frontend/composables/api/use-app-info.ts

18 lines
520 B
TypeScript
Raw Normal View History

import { ref, Ref, useAsync, useContext } from "@nuxtjs/composition-api";
import { useAsyncKey } from "../use-utils";
import { AppInfo } from "~/lib/api/types/admin";
export function useAppInfo(): Ref<AppInfo | null> {
2022-03-15 19:31:45 -08:00
const appInfo = ref<null | AppInfo>(null);
const { $axios, i18n } = useContext();
$axios.setHeader("Accept-Language", i18n.locale);
useAsync(async () => {
const data = await $axios.get<AppInfo>("/api/app/about");
appInfo.value = data.data;
}, useAsyncKey());
2022-03-15 19:31:45 -08:00
return appInfo;
}