feat: Introduce application version display in the frontend footer, showing both frontend and backend versions with integrated build arguments.
All checks were successful
Release and Build Docker Images / release-and-build (push) Successful in 1m29s
All checks were successful
Release and Build Docker Images / release-and-build (push) Successful in 1m29s
This commit is contained in:
@@ -1,12 +1,34 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import TodoList from './components/TodoList';
|
||||
import { getVersion } from './services/api';
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
const [backendVersion, setBackendVersion] = useState('...');
|
||||
const frontendVersion = import.meta.env.VITE_APP_VERSION || 'dev';
|
||||
|
||||
useEffect(() => {
|
||||
const fetchVersion = async () => {
|
||||
try {
|
||||
const data = await getVersion();
|
||||
setBackendVersion(data.version || 'dev');
|
||||
} catch (error) {
|
||||
console.error('Error fetching backend version:', error);
|
||||
setBackendVersion('unknown');
|
||||
}
|
||||
};
|
||||
fetchVersion();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<main>
|
||||
<TodoList />
|
||||
</main>
|
||||
<div className="app-container">
|
||||
<main className="main-content">
|
||||
<TodoList />
|
||||
</main>
|
||||
<footer className="app-footer">
|
||||
<p>Frontend <code>{frontendVersion}</code> | Backend <code>{backendVersion}</code></p>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user