mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-04 18:29:21 +02:00
Fix react bug not making it possible to complete security form
This commit is contained in:
@@ -117,6 +117,7 @@ export default function SecurityPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function LogRetentionSectionForm({ org }: SectionFormProps) {
|
function LogRetentionSectionForm({ org }: SectionFormProps) {
|
||||||
|
const { updateOrg } = useOrgContext();
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
resolver: zodResolver(
|
resolver: zodResolver(
|
||||||
SecurityFormSchema.pick({
|
SecurityFormSchema.pick({
|
||||||
@@ -173,6 +174,11 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
// Update organization
|
// Update organization
|
||||||
await api.post(`/org/${org.orgId}`, reqData);
|
await api.post(`/org/${org.orgId}`, reqData);
|
||||||
|
|
||||||
|
// Update the org context immediately so the dropdowns reflect
|
||||||
|
// the saved values without waiting on a re-fetch that could
|
||||||
|
// race a lagging read replica
|
||||||
|
updateOrg(reqData);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: t("orgUpdated"),
|
title: t("orgUpdated"),
|
||||||
description: t("orgUpdatedDescription")
|
description: t("orgUpdatedDescription")
|
||||||
@@ -199,7 +205,10 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
<SettingsSectionForm>
|
<SettingsSectionForm>
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form
|
<form
|
||||||
action={formAction}
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
formAction();
|
||||||
|
}}
|
||||||
className="grid gap-4"
|
className="grid gap-4"
|
||||||
id="org-log-retention-settings-form"
|
id="org-log-retention-settings-form"
|
||||||
>
|
>
|
||||||
@@ -827,6 +836,7 @@ function LogRetentionSectionForm({ org }: SectionFormProps) {
|
|||||||
|
|
||||||
function SecuritySettingsSectionForm({ org }: SectionFormProps) {
|
function SecuritySettingsSectionForm({ org }: SectionFormProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { updateOrg } = useOrgContext();
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
resolver: zodResolver(
|
resolver: zodResolver(
|
||||||
SecurityFormSchema.pick({
|
SecurityFormSchema.pick({
|
||||||
@@ -899,6 +909,11 @@ function SecuritySettingsSectionForm({ org }: SectionFormProps) {
|
|||||||
// Update organization
|
// Update organization
|
||||||
await api.post(`/org/${org.orgId}`, reqData);
|
await api.post(`/org/${org.orgId}`, reqData);
|
||||||
|
|
||||||
|
// Update the org context immediately so the dropdowns reflect
|
||||||
|
// the saved values without waiting on a re-fetch that could
|
||||||
|
// race a lagging read replica
|
||||||
|
updateOrg(reqData);
|
||||||
|
|
||||||
toast({
|
toast({
|
||||||
title: t("orgUpdated"),
|
title: t("orgUpdated"),
|
||||||
description: t("orgUpdatedDescription")
|
description: t("orgUpdatedDescription")
|
||||||
@@ -942,7 +957,10 @@ function SecuritySettingsSectionForm({ org }: SectionFormProps) {
|
|||||||
<SettingsSectionForm>
|
<SettingsSectionForm>
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form
|
<form
|
||||||
action={formAction}
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
formAction();
|
||||||
|
}}
|
||||||
ref={formRef}
|
ref={formRef}
|
||||||
id="security-settings-section-form"
|
id="security-settings-section-form"
|
||||||
className="space-y-4"
|
className="space-y-4"
|
||||||
|
|||||||
Reference in New Issue
Block a user