diff --git a/src/api/version.ts b/src/api/version.ts
new file mode 100644
index 0000000..af779f0
--- /dev/null
+++ b/src/api/version.ts
@@ -0,0 +1,10 @@
+import { API_BASE_URL, extractErrorMessage } from '@/api/http'
+import type { VersionInfo } from '@/types/version'
+
+export async function getVersionApi(): Promise {
+ const response = await fetch(`${API_BASE_URL}/version`)
+ if (!response.ok) {
+ throw new Error(await extractErrorMessage(response, 'Failed to load API version'))
+ }
+ return response.json()
+}
diff --git a/src/types/version.ts b/src/types/version.ts
new file mode 100644
index 0000000..b7cbe2b
--- /dev/null
+++ b/src/types/version.ts
@@ -0,0 +1,5 @@
+export interface VersionInfo {
+ version: string
+ commit: string
+ buildTime: string
+}
diff --git a/src/views/AccountView.vue b/src/views/AccountView.vue
index 53df3d2..a10494e 100644
--- a/src/views/AccountView.vue
+++ b/src/views/AccountView.vue
@@ -2,6 +2,8 @@
import { onMounted, ref } from 'vue'
import { useListsStore } from '@/stores/lists'
import { useAuthStore } from '@/stores/auth'
+import { getVersionApi } from '@/api/version'
+import type { VersionInfo } from '@/types/version'
import ChangePasswordModal from '@/components/ChangePasswordModal.vue'
import InvitesPanel from '@/components/InvitesPanel.vue'
@@ -9,10 +11,27 @@ const listsStore = useListsStore()
const authStore = useAuthStore()
const showChangePassword = ref(false)
+const versionInfo = ref(null)
+const versionError = ref('')
+const isLoadingVersion = ref(false)
onMounted(() => {
listsStore.loadLists()
+ loadVersion()
})
+
+async function loadVersion() {
+ isLoadingVersion.value = true
+ versionError.value = ''
+ try {
+ versionInfo.value = await getVersionApi()
+ } catch (err) {
+ versionError.value = err instanceof Error ? err.message : 'Failed to load API information'
+ } finally {
+ isLoadingVersion.value = false
+ }
+}
+
@@ -51,6 +70,27 @@ onMounted(() => {
+ API information
+
+
+ Loading…
+
+
+ Version
+ {{ versionInfo.version }}
+
+
+ Commit
+ {{ versionInfo.commit }}
+
+
+ Build time
+ {{ versionInfo.buildTime }}
+
+
+ {{ versionError }}
+
+
@@ -107,4 +147,10 @@ onMounted(() => {
margin-top: 0.6rem;
padding: 0.5rem 1rem;
}
+
+.loading-text {
+ font-size: 0.85rem;
+ color: var(--c-text-soft);
+ margin: 0;
+}