mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-18 14:02:40 +00:00
Redirect to project dashboard when project access is revoked (#16270)
GitOrigin-RevId: 4e90789fee440feec5360660305d414ea8193704
This commit is contained in:
parent
1ce16dd09f
commit
d0bbcca839
1 changed files with 12 additions and 1 deletions
|
@ -11,6 +11,7 @@ import { useModalsContext } from '@/features/ide-react/context/modals-context'
|
||||||
import { debugConsole } from '@/utils/debugging'
|
import { debugConsole } from '@/utils/debugging'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
import { PublicAccessLevel } from '../../../../../types/public-access-level'
|
import { PublicAccessLevel } from '../../../../../types/public-access-level'
|
||||||
|
import { useLocation } from '@/shared/hooks/use-location'
|
||||||
|
|
||||||
function useSocketListeners() {
|
function useSocketListeners() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
@ -20,6 +21,7 @@ function useSocketListeners() {
|
||||||
const [, setPublicAccessLevel] = useScopeValue('project.publicAccesLevel')
|
const [, setPublicAccessLevel] = useScopeValue('project.publicAccesLevel')
|
||||||
const [, setProjectMembers] = useScopeValue('project.members')
|
const [, setProjectMembers] = useScopeValue('project.members')
|
||||||
const [, setProjectInvites] = useScopeValue('project.invites')
|
const [, setProjectInvites] = useScopeValue('project.invites')
|
||||||
|
const location = useLocation()
|
||||||
|
|
||||||
useSocketListener(
|
useSocketListener(
|
||||||
socket,
|
socket,
|
||||||
|
@ -31,7 +33,16 @@ function useSocketListeners() {
|
||||||
'you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard'
|
'you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}, [showGenericMessageModal, t])
|
|
||||||
|
// redirect to project page before reconnect timer runs out and reloads the page
|
||||||
|
const timer = window.setTimeout(() => {
|
||||||
|
location.assign('/project')
|
||||||
|
}, 5000)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.clearTimeout(timer)
|
||||||
|
}
|
||||||
|
}, [showGenericMessageModal, t, location])
|
||||||
)
|
)
|
||||||
|
|
||||||
useSocketListener(
|
useSocketListener(
|
||||||
|
|
Loading…
Reference in a new issue