Fix: "Manage users" button should close modal on settings page (#6)
This commit is contained in:
parent
15efdc4dbd
commit
6fff99530f
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
import TagListField from "components/editorComponents/form/fields/TagListField";
|
import TagListField from "components/editorComponents/form/fields/TagListField";
|
||||||
import { reduxForm, SubmissionError } from "redux-form";
|
import { reduxForm, SubmissionError } from "redux-form";
|
||||||
import SelectField from "components/editorComponents/form/fields/SelectField";
|
import SelectField from "components/editorComponents/form/fields/SelectField";
|
||||||
|
|
@ -124,7 +125,12 @@ const InviteUsersForm = (props: any) => {
|
||||||
fetchUser,
|
fetchUser,
|
||||||
fetchAllRoles,
|
fetchAllRoles,
|
||||||
valid,
|
valid,
|
||||||
|
onCancel,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
const currentPath = useLocation().pathname;
|
||||||
|
const pathRegex = /(?:\/org\/)\w+(?:\/settings)/;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchUser(props.orgId);
|
fetchUser(props.orgId);
|
||||||
fetchAllRoles(props.orgId);
|
fetchAllRoles(props.orgId);
|
||||||
|
|
@ -184,7 +190,9 @@ const InviteUsersForm = (props: any) => {
|
||||||
filled
|
filled
|
||||||
intent="primary"
|
intent="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push(`/org/${props.orgId}/settings`);
|
pathRegex.test(currentPath)
|
||||||
|
? onCancel()
|
||||||
|
: history.push(`/org/${props.orgId}/settings`);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</StyledForm>
|
</StyledForm>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user