0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): enforce SSOT for webhook signing key (#3909)

This commit is contained in:
Xiao Yijun 2023-05-28 09:22:15 +08:00 committed by GitHub
parent 2b409fcefe
commit a9c34cd0b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,4 @@
import { type Hook } from '@logto/schemas';
import { useState } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import { toast } from 'react-hot-toast';
import { useTranslation } from 'react-i18next';
@ -21,7 +20,6 @@ import TestWebhook from './components/TestWebhook';
function WebhookSettings() {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const { hook, isDeleting, onHookUpdated } = useOutletContext<WebhookDetailsOutletContext>();
const [signingKey, setSigningKey] = useState(hook.signingKey);
const webhookFormData = webhookDetailsParser.toLocalForm(hook);
const formMethods = useForm<WebhookDetailsFormType>({
defaultValues: webhookFormData,
@ -59,8 +57,10 @@ function WebhookSettings() {
<BasicWebhookForm />
<SigningKeyField
hookId={hook.id}
signingKey={signingKey}
onSigningKeyUpdated={setSigningKey}
signingKey={hook.signingKey}
onSigningKeyUpdated={(signingKey) => {
onHookUpdated({ ...hook, signingKey });
}}
/>
<CustomHeaderField />
</FormCard>