import { useTranslation } from "react-i18next"; import { useAppSelector } from "../../store"; import { userService } from "../../services"; import { showCommonDialog } from "../Dialog/CommonDialog"; import showChangePasswordDialog from "../ChangePasswordDialog"; import showUpdateAccountDialog from "../UpdateAccountDialog"; import "../../less/settings/my-account-section.less"; const MyAccountSection = () => { const { t } = useTranslation(); const user = useAppSelector((state) => state.user.user as User); const openAPIRoute = `${window.location.origin}/api/memo?openId=${user.openId}`; const handleResetOpenIdBtnClick = async () => { showCommonDialog({ title: "Reset Open API", content: "❗️The existing API will be invalidated and a new one will be generated, are you sure you want to reset?", style: "warning", onConfirm: async () => { await userService.patchUser({ id: user.id, resetOpenId: true, }); }, }); }; return ( <>
{t("setting.account-section.title")}
Open API
{openAPIRoute}
{t("common.reset")} API{`POST ${openAPIRoute}\nContent-type: application/json\n{\n "content": "Hello #memos from ${window.location.origin}"\n}`}