diff --git a/chaoscenter/web/src/controllers/DeleteProjectInvitation/DeleteProjectInvitation.tsx b/chaoscenter/web/src/controllers/DeleteProjectInvitation/DeleteProjectInvitation.tsx index 637bfab2ae4..84148bea652 100644 --- a/chaoscenter/web/src/controllers/DeleteProjectInvitation/DeleteProjectInvitation.tsx +++ b/chaoscenter/web/src/controllers/DeleteProjectInvitation/DeleteProjectInvitation.tsx @@ -17,7 +17,12 @@ export default function DeleteProjectInvitationController( const { handleClose, listInvitationsRefetch, projectID } = props; const { mutate: declineInvitationMutation } = useDeclineInvitationMutation( {}, - { onSuccess: () => listInvitationsRefetch() } + { + onSuccess: () => { + listInvitationsRefetch(); + handleClose(); + } + } ); return ( diff --git a/chaoscenter/web/src/controllers/LeaveProject/LeaveProject.tsx b/chaoscenter/web/src/controllers/LeaveProject/LeaveProject.tsx index ffdb36e94fd..04cb0bd9855 100644 --- a/chaoscenter/web/src/controllers/LeaveProject/LeaveProject.tsx +++ b/chaoscenter/web/src/controllers/LeaveProject/LeaveProject.tsx @@ -23,6 +23,7 @@ export default function LeaveProjectController(props: LeaveProjectControllerProp onSuccess: () => { projectsJoinedRefetch(); getUserWithProjectsRefetch(); + handleClose(); } } ); diff --git a/chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx b/chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx index 59fca7a6883..1e77b8d112b 100644 --- a/chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx +++ b/chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx @@ -1,7 +1,7 @@ import type { UseMutateFunction } from '@tanstack/react-query'; import React from 'react'; import { FontVariation } from '@harnessio/design-system'; -import { Layout, Container, FormInput, ButtonVariation, Text, Button } from '@harnessio/uicore'; +import { Layout, Container, FormInput, ButtonVariation, Text, Button, useToaster } from '@harnessio/uicore'; import { Formik, Form } from 'formik'; import { Icon } from '@harnessio/icons'; import * as Yup from 'yup'; @@ -28,17 +28,28 @@ interface CreateNewUserFormProps { export default function CreateNewUserView(props: CreateNewUserViewProps): React.ReactElement { const { createNewUserMutation, createNewUserMutationLoading, handleClose } = props; const { getString } = useStrings(); + const { showError } = useToaster(); function handleSubmit(values: CreateNewUserFormProps): void { - createNewUserMutation({ - body: { - name: values.name, - email: values.email, - username: values.username, - password: values.password, - role: 'user' + createNewUserMutation( + { + body: { + name: values.name, + email: values.email, + username: values.username, + password: values.password, + role: 'user' + } + }, + { + onSuccess: () => { + handleClose(); + }, + onError: (err: any) => { + showError(err.errorDescription); + } } - }); + ); } return ( diff --git a/chaoscenter/web/src/views/ProjectInvitations/ProjectInvitations.tsx b/chaoscenter/web/src/views/ProjectInvitations/ProjectInvitations.tsx index 6a8fbc0cd77..df6793199af 100644 --- a/chaoscenter/web/src/views/ProjectInvitations/ProjectInvitations.tsx +++ b/chaoscenter/web/src/views/ProjectInvitations/ProjectInvitations.tsx @@ -100,7 +100,7 @@ function MemoizedInvitationsTable(props: InvitationsTableProps): React.ReactElem return (