fix(#175): fix add to favourites and acces to match

pull/42/head
Andrei Dekterev 3 years ago
parent cd4d2cdfd3
commit 3aca022f7b
  1. 3
      src/features/AuthServiceApp/components/Oauth/hooks.tsx
  2. 2
      src/features/MatchPage/components/SubscriptionGuard/index.tsx
  3. 2
      src/features/MatchPage/index.tsx
  4. 2
      src/features/MatchPage/store/hooks/index.tsx
  5. 17
      src/features/StreamPlayer/index.tsx
  6. 4
      src/features/SystemSettings/hooks.tsx

@ -9,11 +9,10 @@ import {
} from 'react' } from 'react'
import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail' import { isValidEmail } from 'features/AuthServiceApp/helpers/isValidEmail'
import { API_ROOT } from 'features/AuthServiceApp/config/routes'
import { addAccessTokenToUrl } from 'helpers/languageUrlParam' import { addAccessTokenToUrl } from 'helpers/languageUrlParam'
import { API_ROOT } from 'config/routes'
export const useOauth = () => { export const useOauth = () => {
const [email, setEmail] = useState('') const [email, setEmail] = useState('')
const [error, setError] = useState('') const [error, setError] = useState('')

@ -42,7 +42,7 @@ export const SubscriptionGuard = ({ children }: Props) => {
return ( return (
<Fragment> <Fragment>
{matchProfile?.sub ? children : null} {matchProfile?.sub || !user ? children : null}
</Fragment> </Fragment>
) )
} }

@ -36,7 +36,7 @@ const MatchPageComponent = () => {
profile, profile,
user, user,
} = useMatchPageStore() } = useMatchPageStore()
const isFavorite = profile && userFavorites.find((fav) => fav.id === profile?.tournament.id) const isFavorite = profile && userFavorites?.find((fav) => fav.id === profile?.tournament.id)
const { const {
profileType, profileType,

@ -90,7 +90,7 @@ export const useMatchPage = () => {
if (error || (duration && Number(duration) > ACCESS_TIME)) { if (error || (duration && Number(duration) > ACCESS_TIME)) {
setAccess(false) setAccess(false)
} }
}), 1000 * 5, }), 1000 * 30,
) )
// eslint-disable-next-line // eslint-disable-next-line
return () => clearInterval(getIntervalMatch) return () => clearInterval(getIntervalMatch)

@ -90,6 +90,7 @@ export const StreamPlayer = (props: Props) => {
volumeInPercent, volumeInPercent,
wrapperRef, wrapperRef,
} = useVideoPlayer(props) } = useVideoPlayer(props)
return ( return (
<PlayerWrapper <PlayerWrapper
ref={wrapperRef} ref={wrapperRef}
@ -196,13 +197,15 @@ export const StreamPlayer = (props: Props) => {
selectedAudioTrack={selectedAudioTrack} selectedAudioTrack={selectedAudioTrack}
/> />
<ControlsGradient isVisible={mainControlsVisible} /> <ControlsGradient isVisible={mainControlsVisible} />
!user && <AccessTimer {!user && (
access={access} <AccessTimer
isFullscreen={isFullscreen} access={access}
onFullscreenClick={onFullscreenClick} isFullscreen={isFullscreen}
playing={ready && playing && !!playedProgress} onFullscreenClick={onFullscreenClick}
onPause={onPause} playing={ready && playing && !!playedProgress}
/> onPause={onPause}
/>
)}
</PlayerWrapper> </PlayerWrapper>
) )
} }

@ -9,6 +9,8 @@ import { SELECTED_API_KEY } from 'helpers/selectedApi'
import { useToggle } from 'hooks/useToggle' import { useToggle } from 'hooks/useToggle'
import { useLocalStore } from 'hooks/useStorage' import { useLocalStore } from 'hooks/useStorage'
import { removeToken } from '../../helpers'
import { removeCookie } from '../../helpers/cookie'
type FormElement = HTMLFormElement & { type FormElement = HTMLFormElement & {
api: HTMLInputElement & { api: HTMLInputElement & {
@ -34,6 +36,8 @@ export const useSystemSettings = () => {
const { api } = e.currentTarget const { api } = e.currentTarget
setSelectedApi(api.value) setSelectedApi(api.value)
removeToken()
removeCookie('access_token')
window.location.reload() window.location.reload()
} }

Loading…
Cancel
Save