diff --git a/components/replication/new-form.tsx b/components/replication/new-form.tsx index 32524ab..ddb5209 100644 --- a/components/replication/new-form.tsx +++ b/components/replication/new-form.tsx @@ -32,7 +32,7 @@ export function ReplicationNewForm({ open, onOpenChange, bucketName, onSuccess } const { setRemoteReplicationTarget, putBucketReplication, getBucketReplication } = useBucket() const [level, setLevel] = useState("1") - const [endpoint, setEndpoint] = useState("http://") + const [endpoint, setEndpoint] = useState("") const [tls, setTls] = useState(false) const [accessKey, setAccessKey] = useState("") const [secretKey, setSecretKey] = useState("") @@ -66,25 +66,9 @@ export function ReplicationNewForm({ open, onOpenChange, bucketName, onSuccess } [], ) - useEffect(() => { - if (tls) { - if (endpoint.startsWith("http://")) { - setEndpoint(endpoint.replace("http://", "https://")) - } else if (!endpoint.startsWith("https://")) { - setEndpoint("https://" + endpoint) - } - } else { - if (endpoint.startsWith("https://")) { - setEndpoint(endpoint.replace("https://", "http://")) - } else if (!endpoint.startsWith("http://")) { - setEndpoint("http://" + endpoint) - } - } - }, [tls, endpoint]) - const resetForm = useCallback(() => { setLevel("1") - setEndpoint("http://") + setEndpoint("") setTls(false) setAccessKey("") setSecretKey("") @@ -309,11 +293,17 @@ export function ReplicationNewForm({ open, onOpenChange, bucketName, onSuccess } {t("Endpoint")} - setEndpoint(e.target.value)} - placeholder={t("Please enter endpoint")} - /> +
+
+ {tls ? "https://" : "http://"} +
+ setEndpoint(e.target.value)} + placeholder={t("Please enter endpoint")} + /> +