diff --git a/frontend/app/PrivateRoutes.tsx b/frontend/app/PrivateRoutes.tsx index a7c2de1a0..22db28530 100644 --- a/frontend/app/PrivateRoutes.tsx +++ b/frontend/app/PrivateRoutes.tsx @@ -291,6 +291,6 @@ export default connect((state: any) => ({ onboarding: state.getIn(['user', 'onboarding']), sites: state.getIn(['site', 'list']), siteId: state.getIn(['site', 'siteId']), - spotOnly: getScope(state) === 'spot', + spotOnly: getScope(state) === 1, tenantId: state.getIn(['user', 'account', 'tenantId']), }))(PrivateRoutes); diff --git a/frontend/app/Router.tsx b/frontend/app/Router.tsx index be3e753ce..8448f824b 100644 --- a/frontend/app/Router.tsx +++ b/frontend/app/Router.tsx @@ -20,7 +20,7 @@ import { fetchListActive as fetchMetadata } from 'Duck/customField'; import { setSessionPath } from 'Duck/sessions'; import { fetchList as fetchSiteList } from 'Duck/site'; import { init as initSite } from 'Duck/site'; -import { fetchUserInfo, setJwt } from 'Duck/user'; +import { fetchUserInfo, getScope, setJwt } from "Duck/user"; import { fetchTenants } from 'Duck/user'; import { Loader } from 'UI'; import { spotsList } from "./routes"; @@ -248,7 +248,7 @@ const mapStateToProps = (state: Map) => { 'loading', ]); const sitesLoading = state.getIn(['site', 'fetchListRequest', 'loading']); - const scopeSetup = state.getIn(['user', 'scopeSetup']) + const scopeSetup = getScope(state) === 0 const loading = Boolean(userInfoLoading) || Boolean(sitesLoading) || (!scopeSetup && !siteId); return { siteId, diff --git a/frontend/app/components/Login/Login.tsx b/frontend/app/components/Login/Login.tsx index bd8052b32..f9f3ea478 100644 --- a/frontend/app/components/Login/Login.tsx +++ b/frontend/app/components/Login/Login.tsx @@ -150,7 +150,6 @@ const Login: React.FC = ({ ? `${window.location.origin}/api/sso/saml2?iFrame=true&spot=true` : `${window.location.origin}/api/sso/saml2?spot=true`; - console.log(authDetails.enforceSSO) return (
diff --git a/frontend/app/duck/user.js b/frontend/app/duck/user.js index 3b148becf..f899002f9 100644 --- a/frontend/app/duck/user.js +++ b/frontend/app/duck/user.js @@ -46,7 +46,6 @@ export const initialState = Map({ errors: [], }, scope: null, - scopeSetup: false, }); const setClient = (state, data) => { @@ -92,16 +91,13 @@ const reducer = (state = initialState, action = {}) => { return state .set('account', Account(action.data.user)) .set('scope', action.data.scope) - .set('scopeSetup', true); case UPGRADE_ACCOUNT_SCOPE.SUCCESS: return state .set('scope', 'full') - .set('scopeSetup', false) .set('onboarding', true) case DOWNGRADE_ACCOUNT_SCOPE.SUCCESS: return state .set('scope', 'spot') - .set('scopeSetup', false) case REQUEST_RESET_PASSWORD.SUCCESS: break; case UPDATE_ACCOUNT.SUCCESS: diff --git a/frontend/app/layout/SideMenu.tsx b/frontend/app/layout/SideMenu.tsx index 9f69c82c2..e033c2ec5 100644 --- a/frontend/app/layout/SideMenu.tsx +++ b/frontend/app/layout/SideMenu.tsx @@ -375,7 +375,7 @@ export default withRouter( activeTab: state.getIn(['search', 'activeTab', 'type']), isEnterprise: state.getIn(['user', 'account', 'edition']) === 'ee', account: state.getIn(['user', 'account']), - spotOnly: getScope(state) === 'spot', + spotOnly: getScope(state) === 1, }), { setActiveTab } )(SideMenu) diff --git a/frontend/app/layout/TopRight.tsx b/frontend/app/layout/TopRight.tsx index b5f48730a..2a398eddc 100644 --- a/frontend/app/layout/TopRight.tsx +++ b/frontend/app/layout/TopRight.tsx @@ -52,7 +52,7 @@ function TopRight(props: Props) { function mapStateToProps(state: any) { return { account: state.getIn(['user', 'account']), - spotOnly: getScope(state) === 'spot', + spotOnly: getScope(state) === 1, siteId: state.getIn(['site', 'siteId']), sites: state.getIn(['site', 'list']), boardingCompletion: state.getIn(['dashboard', 'boardingCompletion']),