Fix Settings not updating ApiUri

This commit is contained in:
glax 2024-10-22 18:06:12 +02:00
parent a383ded819
commit f4011a7cbc
2 changed files with 7 additions and 3 deletions

View File

@ -49,7 +49,10 @@ export default function App(){
: <></>} : <></>}
<MonitorJobsList updateList={updateMonitorList} apiUri={apiUri} onStartSearch={() => setShowSearch(true)} onJobsChanged={UpdateList} connectedToBackend={connected} /> <MonitorJobsList updateList={updateMonitorList} apiUri={apiUri} onStartSearch={() => setShowSearch(true)} onJobsChanged={UpdateList} connectedToBackend={connected} />
</> </>
: <h1>No connection to backend</h1>} : <>
<h1>No connection to the Backend.</h1>
<h3>Check the Settings ApiUri.</h3>
</>}
<Footer apiUri={apiUri} connectedToBackend={connected} /> <Footer apiUri={apiUri} connectedToBackend={connected} />
</div>) </div>)
} }

View File

@ -1,5 +1,5 @@
import React, {KeyboardEventHandler, useEffect, useState} from 'react'; import React, {KeyboardEventHandler, useEffect, useState} from 'react';
import IFrontendSettings from "./interfaces/IFrontendSettings"; import IFrontendSettings, {FrontendSettingsWith} from "./interfaces/IFrontendSettings";
import '../styles/settings.css'; import '../styles/settings.css';
import IBackendSettings from "./interfaces/IBackendSettings"; import IBackendSettings from "./interfaces/IBackendSettings";
import {getData} from "../App"; import {getData} from "../App";
@ -78,8 +78,9 @@ export default function Settings({backendConnected, apiUri, settings, changeSett
} }
const SubmitApiUri : KeyboardEventHandler<HTMLInputElement> = (e) => { const SubmitApiUri : KeyboardEventHandler<HTMLInputElement> = (e) => {
const newSettings = FrontendSettingsWith(frontendSettings, undefined, e.currentTarget.value);
if(e.key == "Enter") if(e.key == "Enter")
changeSettings(settings); changeSettings(newSettings);
} }
return ( return (