2021-05-13 19:01:58 +03:00
|
|
|
import { useEffect } from 'react'
|
2021-06-01 17:58:21 +03:00
|
|
|
|
|
|
|
import { useAppDispatch } from 'state/hooks'
|
2021-05-13 19:01:58 +03:00
|
|
|
import { updateUserExpertMode } from '../state/user/actions'
|
|
|
|
import useParsedQueryString from './useParsedQueryString'
|
|
|
|
|
|
|
|
export default function ApeModeQueryParamReader(): null {
|
|
|
|
useApeModeQueryParamReader()
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
function useApeModeQueryParamReader() {
|
2021-06-01 17:58:21 +03:00
|
|
|
const dispatch = useAppDispatch()
|
2021-05-13 19:01:58 +03:00
|
|
|
const { ape } = useParsedQueryString()
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (typeof ape !== 'string') return
|
|
|
|
if (ape === '' || ape.toLowerCase() === 'true') {
|
|
|
|
dispatch(updateUserExpertMode({ userExpertMode: true }))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|