fixed redirect when auth is enabled

This commit is contained in:
2023-12-03 11:53:15 +01:00
parent 0ab9f15184
commit 70a8d27d22
3 changed files with 13 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import * as O from 'fp-ts/Option'
import { useEffect, useMemo } from 'react'
import { useNavigate } from 'react-router-dom'
import { useRecoilState, useRecoilValue } from 'recoil'
import { take, timer } from 'rxjs'
import { downloadsState } from '../atoms/downloads'
@@ -23,6 +24,8 @@ const SocketSubscriber: React.FC<Props> = () => {
const { client } = useRPC()
const { pushMessage } = useToast()
const navigate = useNavigate()
const socketOnce$ = useMemo(() => client.socket$.pipe(take(1)), [])
useEffect(() => {
@@ -60,7 +63,8 @@ const SocketSubscriber: React.FC<Props> = () => {
pushMessage(
`${i18n.t('rpcConnErr')} (${serverAddressAndPort})`,
"error"
)
),
navigate(`/error`)
}
)