import { useEffect } from "react"; import Tippy from "@tippyjs/react"; import toast from "react-hot-toast"; import { hideAll } from "tippy.js"; import Input from "../../common/component/styled/Input"; import Toggle from "../../common/component/styled/Toggle"; import Button from "../../common/component/styled/Button"; import { useGetThirdPartySecretQuery, useUpdateThirdPartySecretMutation } from "../../app/services/server"; import useConfig from "../../common/hook/useConfig"; import { LoginConfig } from "../../types/server"; import { useTranslation } from "react-i18next"; export default function APIConfig() { const { t } = useTranslation("setting"); const { t: ct } = useTranslation(); const { updateConfig, values } = useConfig("login"); const { data } = useGetThirdPartySecretQuery(); const [updateSecret, { data: updatedSecret, isSuccess, isLoading }] = useUpdateThirdPartySecretMutation(); useEffect(() => { if (isSuccess) { hideAll(); toast.success(ct("tip.update")); } }, [isSuccess]); const handleToggle = (val: { third_party: boolean }) => { updateConfig({ ...values, ...val }); }; const thirdParty = (values as LoginConfig)?.third_party; return (
{t("third_app.update_tip")}
} >
{t("third_app.key_tip")}
); }