fix ui change scope to enum
This commit is contained in:
parent
30dc00a3e7
commit
fee823f69f
6 changed files with 5 additions and 10 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<string, any>) => {
|
|||
'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,
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ const Login: React.FC<LoginProps> = ({
|
|||
? `${window.location.origin}/api/sso/saml2?iFrame=true&spot=true`
|
||||
: `${window.location.origin}/api/sso/saml2?spot=true`;
|
||||
|
||||
console.log(authDetails.enforceSSO)
|
||||
return (
|
||||
<div className="flex items-center justify-center h-screen">
|
||||
<div className="flex flex-col items-center">
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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']),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue