mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
(cherry picked from commit d7fe6f7e3d05fb9dd2830ca17e857b3e509a4892)
This commit is contained in:
parent
20ab78182a
commit
1bcfd773b1
@ -39,14 +39,16 @@ const MainLayout = ({ endpoints, children }) => {
|
||||
isLoginInProcess,
|
||||
getAuthInfo,
|
||||
authUser,
|
||||
firstRender
|
||||
firstRender,
|
||||
isLoading
|
||||
} = useAuth()
|
||||
|
||||
useEffect(() => {
|
||||
if (isLogged && !isLoginInProcess) {
|
||||
console.log({ isLoading })
|
||||
if (isLogged && !isLoginInProcess && !isLoading) {
|
||||
getAuthInfo()
|
||||
}
|
||||
}, [isLogged, isLoginInProcess])
|
||||
}, [isLogged, isLoginInProcess, pathname])
|
||||
|
||||
const { authenticated } = findRouteByPathname(ENDPOINTS, pathname)
|
||||
const authRoute = Boolean(authenticated)
|
||||
|
@ -85,7 +85,7 @@ const Sidebar = memo(({ endpoints }) => {
|
||||
</Box>
|
||||
</Drawer>
|
||||
)
|
||||
}, (prev, next) => prev.endpoints === next.endpoints)
|
||||
}, (prev, next) => prev.endpoints.length === next.endpoints.length)
|
||||
|
||||
Sidebar.propTypes = {
|
||||
endpoints: PropTypes.array
|
||||
|
@ -35,6 +35,7 @@ module.exports = {
|
||||
Token2FA: '2FA Token',
|
||||
KeepLoggedIn: 'Keep me logged in',
|
||||
Credentials: 'Credentials',
|
||||
SessionExpired: 'Sorry, your session has expired',
|
||||
|
||||
/* errors */
|
||||
CannotConnectOneFlow: 'Cannot connect to OneFlow server',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useCallback, useEffect } from 'react'
|
||||
import { useSelector, useDispatch, shallowEqual } from 'react-redux'
|
||||
|
||||
import { JWT_NAME, FILTER_POOL, ONEADMIN_ID, TIME_HIDE_LOGO } from 'client/constants'
|
||||
import { T, JWT_NAME, FILTER_POOL, ONEADMIN_ID, TIME_HIDE_LOGO } from 'client/constants'
|
||||
import { storage, findStorageData, removeStoreData, fakeDelay } from 'client/utils'
|
||||
|
||||
import * as serviceAuth from 'client/services/auth'
|
||||
@ -84,7 +84,10 @@ const useAuth = () => {
|
||||
.then(() => dispatch(updateSetting))
|
||||
.then(() => serviceOne.getGroups())
|
||||
.then(groups => dispatch(setGroups(groups)))
|
||||
.catch(err => dispatch(failureAuth({ error: err })))
|
||||
.catch(() => {
|
||||
dispatch(logoutRequest())
|
||||
dispatch(failureAuth({ error: T.SessionExpired }))
|
||||
})
|
||||
}, [dispatch, JWT_NAME, authUser])
|
||||
|
||||
const setPrimaryGroup = useCallback(
|
||||
|
Loading…
x
Reference in New Issue
Block a user