mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 22:27:48 +00:00
Fix: Select org after creation
This commit is contained in:
@@ -6,7 +6,7 @@ import z from "zod";
|
|||||||
|
|
||||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
|
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
|
||||||
import { useCreateOrg } from "@app/hooks/api";
|
import { useCreateOrg, useSelectOrganization } from "@app/hooks/api";
|
||||||
|
|
||||||
const schema = z
|
const schema = z
|
||||||
.object({
|
.object({
|
||||||
@@ -37,14 +37,21 @@ export const CreateOrgModal: FC<CreateOrgModalProps> = ({ isOpen, onClose }) =>
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { mutateAsync } = useCreateOrg();
|
const { mutateAsync: createOrg } = useCreateOrg({
|
||||||
|
invalidate: false
|
||||||
|
});
|
||||||
|
const { mutateAsync: selectOrg } = useSelectOrganization();
|
||||||
|
|
||||||
const onFormSubmit = async ({ name }: FormData) => {
|
const onFormSubmit = async ({ name }: FormData) => {
|
||||||
try {
|
try {
|
||||||
const organization = await mutateAsync({
|
const organization = await createOrg({
|
||||||
name
|
name
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await selectOrg({
|
||||||
|
organizationId: organization.id
|
||||||
|
});
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
text: "Successfully created organization",
|
text: "Successfully created organization",
|
||||||
type: "success"
|
type: "success"
|
||||||
|
|||||||
Reference in New Issue
Block a user