diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx index 144bcd0bf..191634af8 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx @@ -32,7 +32,6 @@ import { IWizardButton, IWizardElement, } from "../../Common/GenericWizard/types"; -import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt"; import { AppState } from "../../../../store"; import Configure from "./Steps/Configure"; import IdentityProvider from "./Steps/IdentityProvider"; @@ -57,6 +56,7 @@ import { selFeatures } from "../../consoleSlice"; import makeStyles from "@mui/styles/makeStyles"; import { resetAddTenantForm } from "./createTenantSlice"; import CreateTenantButton from "./CreateTenantButton"; +import NewTenantCredentials from "./NewTenantCredentials"; const useStyles = makeStyles((theme: Theme) => createStyles({ @@ -75,14 +75,6 @@ const AddTenant = () => { const features = useSelector(selFeatures); - // Modals - const showNewCredentials = useSelector( - (state: AppState) => state.createTenant.showNewCredentials - ); - const createdAccount = useSelector( - (state: AppState) => state.createTenant.createdAccount - ); - // Fields const addSending = useSelector( (state: AppState) => state.createTenant.addingTenant @@ -181,23 +173,9 @@ const AddTenant = () => { let filteredWizardSteps = wizardSteps; - const closeCredentialsModal = () => { - dispatch(resetAddTenantForm()); - history.push("/tenants"); - }; - return ( - {showNewCredentials && ( - { - closeCredentialsModal(); - }} - entity="Tenant" - /> - )} + . + +import React, { Fragment } from "react"; +import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt"; +import { resetAddTenantForm } from "./createTenantSlice"; +import history from "../../../../history"; +import { useDispatch, useSelector } from "react-redux"; +import { AppState } from "../../../../store"; + +const NewTenantCredentials = () => { + const dispatch = useDispatch(); + + const showNewCredentials = useSelector( + (state: AppState) => state.createTenant.showNewCredentials + ); + const createdAccount = useSelector( + (state: AppState) => state.createTenant.createdAccount + ); + + return ( + + {showNewCredentials && ( + { + dispatch(resetAddTenantForm()); + history.push("/tenants"); + }} + entity="Tenant" + /> + )} + + ); +}; + +export default NewTenantCredentials; diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/thunks/namespaceThunks.ts b/portal-ui/src/screens/Console/Tenants/AddTenant/thunks/namespaceThunks.ts index 9e284978b..6cea72564 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/thunks/namespaceThunks.ts +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/thunks/namespaceThunks.ts @@ -89,7 +89,7 @@ export const createNamespaceAsync = createAsyncThunk( .invoke("POST", "/api/v1/namespace", { name: namespace, }) - .then((res) => { + .then((_) => { // revalidate the name to have the storage classes populated dispatch(validateNamespaceAsync()); return true;