mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 20:42:39 +00:00
feat: Consolidate version display to use health endpoint.
This commit is contained in:
@@ -30,16 +30,7 @@ export function SiteHeader() {
|
||||
refetchInterval: 30000,
|
||||
});
|
||||
|
||||
const {
|
||||
data: versionData,
|
||||
isLoading: versionLoading,
|
||||
isError: versionError,
|
||||
} = useQuery({
|
||||
queryKey: ["version"],
|
||||
queryFn: apiClient.getVersion,
|
||||
refetchInterval: 5 * 60 * 1000, // Refetch version every 5 minutes
|
||||
retry: 1, // Only retry once since version is less critical
|
||||
});
|
||||
|
||||
|
||||
return (
|
||||
<header className="flex h-16 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear pt-safe-top">
|
||||
@@ -56,17 +47,17 @@ export function SiteHeader() {
|
||||
<div className="ml-auto flex items-center space-x-3">
|
||||
{/* Version display */}
|
||||
<div className="flex items-center space-x-1">
|
||||
{versionLoading ? (
|
||||
{healthLoading ? (
|
||||
<span className="text-xs text-muted-foreground">v...</span>
|
||||
) : versionError || !versionData ? (
|
||||
) : healthError || !healthStatus ? (
|
||||
<span className="text-xs text-muted-foreground">v?</span>
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
v{versionData.version}
|
||||
v{healthStatus.version || "?"}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
{/* Connection status */}
|
||||
<div className="flex items-center space-x-1">
|
||||
{healthLoading ? (
|
||||
|
||||
@@ -10,7 +10,6 @@ import type {
|
||||
NotificationService,
|
||||
NotificationServicesResponse,
|
||||
HealthData,
|
||||
VersionData,
|
||||
AccountUpdate,
|
||||
TransactionStats,
|
||||
} from "../types/api";
|
||||
@@ -168,14 +167,7 @@ export const apiClient = {
|
||||
return response.data.data;
|
||||
},
|
||||
|
||||
// Get version information
|
||||
getVersion: async (): Promise<VersionData> => {
|
||||
// Use the root endpoint (/) which provides version information
|
||||
const response = await api.get<VersionData>("/", {
|
||||
baseURL: import.meta.env.VITE_API_URL?.replace('/api/v1', '') || '',
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
|
||||
// Analytics endpoints
|
||||
getTransactionStats: async (days?: number): Promise<TransactionStats> => {
|
||||
|
||||
@@ -197,6 +197,7 @@ export interface NotificationServicesResponse {
|
||||
export interface HealthData {
|
||||
status: string;
|
||||
config_loaded?: boolean;
|
||||
version?: string;
|
||||
message?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user