Don't let the user close the endpoint dialog window if the endpoint is an invalid URL

This commit is contained in:
powermaker450 2024-09-09 19:00:27 -04:00
parent 69a1de99e2
commit 42bbb67639

View file

@ -24,6 +24,10 @@ const EndpointDialog = ({ endpoint }: EndpointDialogProps) => {
}; };
const closeSettings = () => { const closeSettings = () => {
if (error) {
return;
}
setOpen(false); setOpen(false);
setError(false); setError(false);
@ -78,9 +82,9 @@ const EndpointDialog = ({ endpoint }: EndpointDialogProps) => {
/> />
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<Button onClick={closeSettings}>Close</Button> <Button
disabled={error}
<Button onClick={() => { onClick={() => {
if (isValidEndpoint()) { if (isValidEndpoint()) {
closeSettings(); closeSettings();
closeTheError(); closeTheError();