mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-24 16:46:05 +08:00
fix: edit connection state
This commit is contained in:
@ -3,7 +3,7 @@ import { ChangeEvent, useEffect, useState } from "react";
|
||||
import { toast } from "react-hot-toast";
|
||||
import TextareaAutosize from "react-textarea-autosize";
|
||||
import { useConnectionStore } from "@/store";
|
||||
import { Connection, Engine, ResponseObject } from "@/types";
|
||||
import { Connection, Engine, ResponseObject, SSLOptions } from "@/types";
|
||||
import Select from "./kit/Select";
|
||||
import TextField from "./kit/TextField";
|
||||
import Modal from "./kit/Modal";
|
||||
@ -66,16 +66,11 @@ const CreateConnectionModal = (props: Props) => {
|
||||
} else {
|
||||
setSSLType("ca-only");
|
||||
}
|
||||
} else {
|
||||
setSSLType("none");
|
||||
}
|
||||
setSelectedSSLField("ca");
|
||||
setIsRequesting(false);
|
||||
setShowDeleteConnectionModal(false);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let ssl = undefined;
|
||||
let ssl: SSLOptions | undefined = undefined;
|
||||
if (sslType === "ca-only") {
|
||||
ssl = {
|
||||
ca: "",
|
||||
@ -87,10 +82,10 @@ const CreateConnectionModal = (props: Props) => {
|
||||
key: "",
|
||||
};
|
||||
}
|
||||
setConnection({
|
||||
setConnection((connection) => ({
|
||||
...connection,
|
||||
ssl,
|
||||
});
|
||||
ssl: ssl,
|
||||
}));
|
||||
setSelectedSSLField("ca");
|
||||
}, [sslType]);
|
||||
|
||||
|
@ -5,7 +5,7 @@ export enum Engine {
|
||||
PostgreSQL = "POSTGRESQL",
|
||||
}
|
||||
|
||||
interface SSLOptions {
|
||||
export interface SSLOptions {
|
||||
ca?: string;
|
||||
cert?: string;
|
||||
key?: string;
|
||||
|
Reference in New Issue
Block a user