fix: smtp enable and send test logic

This commit is contained in:
Tristan Yang
2023-06-08 18:24:36 +08:00
parent 5b27cc1800
commit 18fc5e843d
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -108,6 +108,7 @@ export default function useConfig(config: keyof ConfigMap = "smtp") {
}, [values]);
return {
originalValues: originalValue,
updating,
updated,
reset,
+3 -2
View File
@@ -16,7 +16,8 @@ export default function ConfigSMTP() {
const { t } = useTranslation("setting", { keyPrefix: "smtp" });
const [testEmail, setTestEmail] = useState("");
const [sendTestEmail, { isSuccess, isError }] = useSendTestEmailMutation();
const { reset, updateConfig, values, setValues, changed, toggleEnable } = useConfig("smtp");
const { reset, updateConfig, values, originalValues, setValues, changed, toggleEnable } =
useConfig("smtp");
const handleUpdate = () => {
// const { token_url, description } = values;
@@ -124,7 +125,7 @@ export default function ConfigSMTP() {
<div className="flex gap-4 whitespace-nowrap mt-6">
<Input
type={"email"}
disabled={!enabled}
disabled={!(originalValues as SMTPConfig).enabled}
onChange={handleTestEmailChange}
value={testEmail}
name="email"