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:
parent
37ca3c005a
commit
3290e73978
1 changed files with 4 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
Loading…
Reference in a new issue