fix(fix): fix duplicate request

pull/24/head
Rakov Roman 3 years ago
parent e60b59dde8
commit 1d56682a60
  1. 8
      src/features/Matches/hooks.tsx

@ -13,8 +13,6 @@ import { useRequest } from 'hooks'
import { usePreferencesStore } from 'features/PreferencesPopup'
import { isMobileDevice } from 'config/userAgent'
import { checkUrlParams } from 'helpers/parseUrlParams/parseUrlParams'
import { prepareMatches } from './helpers/prepareMatches'
export type Match = ReturnType<typeof prepareMatches>[number]
@ -68,10 +66,10 @@ export const useMatches = ({ fetch }: Props) => {
isFetching,
])
const dateParam = checkUrlParams('date')
useEffect(() => {
if (dateParam) {
const isDefaultUrl = window.location.href.slice(0, -1) === window.location.origin
if (!isDefaultUrl) {
fetchMatches(0).then(setMatches)
pageRef.current = 1
}

Loading…
Cancel
Save