diff --git a/frontend/src/composables/useApiHelper.ts b/frontend/src/composables/useApiHelper.ts index c82c7ed5..37a2ce31 100644 --- a/frontend/src/composables/useApiHelper.ts +++ b/frontend/src/composables/useApiHelper.ts @@ -1,4 +1,4 @@ -import { PaginatedResult, Project, ProjectCompact, User, Version } from "hangar-api"; +import { PaginatedResult, Project, ProjectCompact, User, Version, VersionInfo } from "hangar-api"; import { Flag, HangarNotification, @@ -15,6 +15,7 @@ import { ReviewQueueEntry, RoleTable, } from "hangar-internal"; +import { Ref } from "vue"; import { useApi, useInternalApi } from "~/composables/useApi"; import { useAsyncData } from "#imports"; @@ -144,6 +145,10 @@ export async function useOrgVisibility(user: string) { .data; } +export async function useVersionInfo(): Promise> { + return (await useAsyncData("useVersionInfo", () => useInternalApi(`data/version-info`))).data; +} + export async function useUserData(user: string) { return ( await useAsyncData("useUserData:" + user, async () => { diff --git a/frontend/src/lib b/frontend/src/lib index 88452f36..9bd784fa 160000 --- a/frontend/src/lib +++ b/frontend/src/lib @@ -1 +1 @@ -Subproject commit 88452f3663de20b8db6d7a87dfcecf8f6600fa07 +Subproject commit 9bd784fac1c77e461c4137b819ea8e555b85b50d diff --git a/frontend/src/module/backendData.ts b/frontend/src/module/backendData.ts index 64cd6865..35054227 100644 --- a/frontend/src/module/backendData.ts +++ b/frontend/src/module/backendData.ts @@ -92,7 +92,6 @@ async function loadData(state: BackendData, axiosInstance: AxiosInstance) { globalRoles, channelColors, flagReasons, - versionInfo, ] = ( await Promise.all([ axiosInstance.get("/categories"), @@ -108,7 +107,6 @@ async function loadData(state: BackendData, axiosInstance: AxiosInstance) { axiosInstance.get("/globalRoles"), axiosInstance.get("/channelColors"), axiosInstance.get("/flagReasons"), - axiosInstance.get("/version-info"), ]) ).map((it) => it.data); @@ -129,5 +127,4 @@ async function loadData(state: BackendData, axiosInstance: AxiosInstance) { state.globalRoles = globalRoles as typeof state.globalRoles; state.channelColors = channelColors as typeof state.channelColors; state.flagReasons = flagReasons as typeof state.flagReasons; - state.versionInfo = versionInfo as typeof state.versionInfo; } diff --git a/frontend/src/pages/admin/stats.vue b/frontend/src/pages/admin/stats.vue index fc8692df..54887360 100644 --- a/frontend/src/pages/admin/stats.vue +++ b/frontend/src/pages/admin/stats.vue @@ -118,7 +118,6 @@ watch(startDate, updateDate); watch(endDate, updateDate); async function updateDate() { - console.log("update", startDate, endDate); data = (await useInternalApi("admin/stats", "get", { from: startDate.value, to: endDate.value, diff --git a/frontend/src/pages/version.vue b/frontend/src/pages/version.vue index 1845bd12..095d0053 100644 --- a/frontend/src/pages/version.vue +++ b/frontend/src/pages/version.vue @@ -2,12 +2,12 @@ import { useHead } from "@vueuse/head"; import { useRoute } from "vue-router"; import PageTitle from "~/lib/components/design/PageTitle.vue"; -import { useBackendData } from "~/store/backendData"; import Link from "~/lib/components/design/Link.vue"; import Alert from "~/lib/components/design/Alert.vue"; import { useSeo } from "~/composables/useSeo"; +import { useVersionInfo } from "~/composables/useApiHelper"; -const version = useBackendData.versionInfo; +const version = await useVersionInfo(); const route = useRoute(); useHead(useSeo("Hangar Version", null, route, null)); @@ -15,40 +15,43 @@ useHead(useSeo("Hangar Version", null, route, null)); diff --git a/frontend/src/types/api.d.ts b/frontend/src/types/api.d.ts index 4822ce99..519cad5b 100644 --- a/frontend/src/types/api.d.ts +++ b/frontend/src/types/api.d.ts @@ -78,6 +78,5 @@ declare module "hangar-api" { globalRoles: Role[]; channelColors: Color[]; flagReasons: FlagReason[]; - versionInfo: VersionInfo; } }