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:
parent
2b409fcefe
commit
a9c34cd0b6
1 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
||||||
import { type Hook } from '@logto/schemas';
|
import { type Hook } from '@logto/schemas';
|
||||||
import { useState } from 'react';
|
|
||||||
import { FormProvider, useForm } from 'react-hook-form';
|
import { FormProvider, useForm } from 'react-hook-form';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
@ -21,7 +20,6 @@ import TestWebhook from './components/TestWebhook';
|
||||||
function WebhookSettings() {
|
function WebhookSettings() {
|
||||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||||
const { hook, isDeleting, onHookUpdated } = useOutletContext<WebhookDetailsOutletContext>();
|
const { hook, isDeleting, onHookUpdated } = useOutletContext<WebhookDetailsOutletContext>();
|
||||||
const [signingKey, setSigningKey] = useState(hook.signingKey);
|
|
||||||
const webhookFormData = webhookDetailsParser.toLocalForm(hook);
|
const webhookFormData = webhookDetailsParser.toLocalForm(hook);
|
||||||
const formMethods = useForm<WebhookDetailsFormType>({
|
const formMethods = useForm<WebhookDetailsFormType>({
|
||||||
defaultValues: webhookFormData,
|
defaultValues: webhookFormData,
|
||||||
|
@ -59,8 +57,10 @@ function WebhookSettings() {
|
||||||
<BasicWebhookForm />
|
<BasicWebhookForm />
|
||||||
<SigningKeyField
|
<SigningKeyField
|
||||||
hookId={hook.id}
|
hookId={hook.id}
|
||||||
signingKey={signingKey}
|
signingKey={hook.signingKey}
|
||||||
onSigningKeyUpdated={setSigningKey}
|
onSigningKeyUpdated={(signingKey) => {
|
||||||
|
onHookUpdated({ ...hook, signingKey });
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<CustomHeaderField />
|
<CustomHeaderField />
|
||||||
</FormCard>
|
</FormCard>
|
||||||
|
|
Loading…
Reference in a new issue