dc53a74459
* style: enforce ordering of imports * style: sort imports in loot-core * style: sort imports in desktop-client * style: sort imports in loot-design * style: manual fixes
24 lines
483 B
JavaScript
24 lines
483 B
JavaScript
import { useState, useEffect } from 'react';
|
|
|
|
import { send } from 'loot-core/src/platform/client/fetch';
|
|
|
|
function useServerVersion() {
|
|
let [version, setVersion] = useState('');
|
|
|
|
useEffect(() => {
|
|
(async () => {
|
|
const { error, version } = await send('get-server-version');
|
|
|
|
if (error) {
|
|
setVersion('');
|
|
} else {
|
|
setVersion(version);
|
|
}
|
|
})();
|
|
}, []);
|
|
|
|
return version ? `v${version}` : 'N/A';
|
|
}
|
|
|
|
export default useServerVersion;
|