mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 01:58:40 -05:00
refactor: get server version via backend method
Avoid touching the server directly. Maintains consistency with existing workflow and centralizes changes in the event that, for example, auth requirements change for this route.
This commit is contained in:
committed by
James Long
parent
37ca3c005a
commit
3290e73978
@@ -477,17 +477,12 @@ function Version() {
|
||||
let [version, setVersion] = useState('');
|
||||
|
||||
useEffect(async () => {
|
||||
const url = await send('get-server-url');
|
||||
if (!url || url.indexOf('not-configured') !== -1) return;
|
||||
const { error, version } = await send('get-server-version');
|
||||
|
||||
try {
|
||||
const res = await fetch(url + '/info');
|
||||
if (!res.ok) return;
|
||||
|
||||
const info = await res.json();
|
||||
setVersion((info && info.build.version) || '');
|
||||
} catch (e) {
|
||||
if (error) {
|
||||
setVersion('');
|
||||
} else {
|
||||
setVersion(version);
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user