fix: wrap async func in useEffect
This commit is contained in:
parent
3290e73978
commit
1a449ae0b8
1 changed files with 9 additions and 7 deletions
|
@ -476,14 +476,16 @@ function SettingsLink({ to, name, style, first, last }) {
|
|||
function Version() {
|
||||
let [version, setVersion] = useState('');
|
||||
|
||||
useEffect(async () => {
|
||||
const { error, version } = await send('get-server-version');
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const { error, version } = await send('get-server-version');
|
||||
|
||||
if (error) {
|
||||
setVersion('');
|
||||
} else {
|
||||
setVersion(version);
|
||||
}
|
||||
if (error) {
|
||||
setVersion('');
|
||||
} else {
|
||||
setVersion(version);
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue