diff --git a/src/components/EndpointDialong.tsx b/src/components/EndpointDialong.tsx index 63f433d..641b8a4 100644 --- a/src/components/EndpointDialong.tsx +++ b/src/components/EndpointDialong.tsx @@ -1,20 +1,24 @@ import { Button, + Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, + FormControlLabel, IconButton, TextField, } from "@mui/material"; import SettingsIcon from "@mui/icons-material/Settings"; import React, { useState } from "react"; +import { CheckBox } from "@mui/icons-material"; export interface EndpointDialogProps { endpoint: [string, React.Dispatch>]; + secure: [boolean, React.Dispatch>]; } -const EndpointDialog = ({ endpoint }: EndpointDialogProps) => { +const EndpointDialog = ({ endpoint, secure }: EndpointDialogProps) => { const [open, setOpen] = useState(false); const [error, setError] = useState(false); const [errorText, setErrorText] = useState(""); @@ -35,7 +39,7 @@ const EndpointDialog = ({ endpoint }: EndpointDialogProps) => { }; const showTheError = () => { - setErrorText("Please enter a valid URL."); + setErrorText('Please omit "http://" or "https://" from the endpoint.'); setError(true); } @@ -45,7 +49,7 @@ const EndpointDialog = ({ endpoint }: EndpointDialogProps) => { } const isValidEndpoint = () => { - return endpoint[0].startsWith("http://") || endpoint[0].startsWith("https://"); + return !(endpoint[0].startsWith("http://") || endpoint[0].startsWith("https://")); } const saveEndpoint = () => { @@ -80,6 +84,19 @@ const EndpointDialog = ({ endpoint }: EndpointDialogProps) => { error={error} helperText={errorText} /> + +
+ + secure[1](!secure[0])} + /> + } + label="HTTPS" + /> +