diff --git a/web/src/components/molecules/MyIntegrations/Content/index.tsx b/web/src/components/molecules/MyIntegrations/Content/index.tsx index 56b41bc1fe..c0667cde3a 100644 --- a/web/src/components/molecules/MyIntegrations/Content/index.tsx +++ b/web/src/components/molecules/MyIntegrations/Content/index.tsx @@ -14,6 +14,7 @@ type Props = { webhookInitialValues?: any; onIntegrationUpdate: (data: { name: string; description: string; logoUrl: string }) => void; onIntegrationDelete: () => Promise; + onRegenerateToken: () => Promise; onWebhookCreate: (data: { name: string; url: string; @@ -38,6 +39,7 @@ const MyIntegrationContent: React.FC = ({ integration, webhookInitialValues, onIntegrationUpdate, + onRegenerateToken, onWebhookCreate, onWebhookDelete, onWebhookUpdate, @@ -56,6 +58,7 @@ const MyIntegrationContent: React.FC = ({ integration={integration} onIntegrationUpdate={onIntegrationUpdate} onIntegrationDelete={onIntegrationDelete} + onRegenerateToken={onRegenerateToken} /> diff --git a/web/src/components/molecules/MyIntegrations/Settings/Form.tsx b/web/src/components/molecules/MyIntegrations/Settings/Form.tsx index f71386c04f..4cb67ee159 100644 --- a/web/src/components/molecules/MyIntegrations/Settings/Form.tsx +++ b/web/src/components/molecules/MyIntegrations/Settings/Form.tsx @@ -6,6 +6,7 @@ import Col from "@reearth-cms/components/atoms/Col"; import Divider from "@reearth-cms/components/atoms/Divider"; import Form from "@reearth-cms/components/atoms/Form"; import Input from "@reearth-cms/components/atoms/Input"; +import Modal from "@reearth-cms/components/atoms/Modal"; import Row from "@reearth-cms/components/atoms/Row"; import TextArea from "@reearth-cms/components/atoms/TextArea"; import { Integration } from "@reearth-cms/components/molecules/MyIntegrations/types"; @@ -14,9 +15,14 @@ import { useT } from "@reearth-cms/i18n"; export type Props = { integration: Integration; onIntegrationUpdate: (data: { name: string; description: string; logoUrl: string }) => void; + onRegenerateToken: () => Promise; }; -const MyIntegrationForm: React.FC = ({ integration, onIntegrationUpdate }) => { +const MyIntegrationForm: React.FC = ({ + integration, + onIntegrationUpdate, + onRegenerateToken, +}) => { const t = useT(); const [form] = Form.useForm(); @@ -30,6 +36,19 @@ const MyIntegrationForm: React.FC = ({ integration, onIntegrationUpdate } } }, [form, onIntegrationUpdate]); + const handleRegenerateToken = useCallback(() => { + Modal.confirm({ + title: t("Regenerate The Integration Token?"), + content: t( + "If you regenerate the integration token, the previous token will become invalid, and this action cannot be undone. Are you sure you want to proceed?", + ), + okText: t("Reset"), + onOk() { + onRegenerateToken(); + }, + }); + }, [t, onRegenerateToken]); + return (
@@ -49,7 +68,10 @@ const MyIntegrationForm: React.FC = ({ integration, onIntegrationUpdate }