diff --git a/src/features/App/index.tsx b/src/features/App/index.tsx
index 5c159594..ae52a456 100644
--- a/src/features/App/index.tsx
+++ b/src/features/App/index.tsx
@@ -19,13 +19,15 @@ import { JoinMatchPage } from 'features/JoinMatchPage'
import { JoinMatchPageRFEF } from 'features/JoinMatchPageRFEF'
import { AuthenticatedApp } from './AuthenticatedApp'
+import { checkPage } from '../../helpers/checkPage'
+import { PAGES } from '../../config'
setClientTitleAndDescription(client.title, client.description)
const Main = () => {
const { loadingUser, user } = useAuthStore()
- if (!user && isMatchPage()) return
+ if (!user && (isMatchPage() || checkPage(PAGES.tournament))) return
if (!user && isMatchPageRFEF()) return
if (user && isMatchPageRFEF()) {
diff --git a/src/features/AuthStore/hooks/useAuth.tsx b/src/features/AuthStore/hooks/useAuth.tsx
index b4a4b176..e0741595 100644
--- a/src/features/AuthStore/hooks/useAuth.tsx
+++ b/src/features/AuthStore/hooks/useAuth.tsx
@@ -67,6 +67,7 @@ export const useAuth = () => {
}, [])
const checkUser = useCallback(async () => {
+ if (!user) return null
const loadedUser = await userManager.getUser()
if (!loadedUser) return Promise.reject()
@@ -77,6 +78,7 @@ export const useAuth = () => {
userManager,
storeUser,
markUserLoaded,
+ user,
])
const [page, setPage] = useLocalStore({
diff --git a/src/features/JoinMatchPage/hooks.tsx b/src/features/JoinMatchPage/hooks.tsx
index ac66e9c0..fd40b661 100644
--- a/src/features/JoinMatchPage/hooks.tsx
+++ b/src/features/JoinMatchPage/hooks.tsx
@@ -21,17 +21,27 @@ export const useUnauthenticatedMatch = () => {
matchInfo, setMatchInfo,
] = useState(null)
- const { profileId: matchId, sportType } = usePageParams()
-
+ const {
+ profileId: matchId,
+ profileType,
+ sportType,
+ } = usePageParams()
const matchDate = matchInfo?.date
? format(parseDate(matchInfo.date), 'd MMM HH:mm')
: ''
useEffect(() => {
- if (sportType && matchId) getUnauthenticatedMatch(sportType, matchId).then(setMatchInfo)
+ if (sportType && matchId) {
+ getUnauthenticatedMatch(
+ sportType,
+ matchId,
+ profileType,
+ )
+ .then(setMatchInfo)
+ }
return () => setMatchInfo(null)
- }, [sportType, matchId])
+ }, [sportType, matchId, profileType])
return {
live: matchInfo?.live,
diff --git a/src/features/JoinMatchPage/index.tsx b/src/features/JoinMatchPage/index.tsx
index d2dfbac2..b6621d03 100644
--- a/src/features/JoinMatchPage/index.tsx
+++ b/src/features/JoinMatchPage/index.tsx
@@ -54,21 +54,30 @@ export const JoinMatchPage = () => {
-
- {matchDate}
- {live && (
-
-
-
-
-
-
- )}
-
+ {matchInfo?.team1
+ && (
+
+ {matchDate}
+ {live && (
+
+
+
+
+
+
+ )}
+
+ )}
-
- —
-
+ {matchInfo?.team1 ? (
+ <>
+
+ —
+
+ >
+
+ ) : ()}
+
diff --git a/src/requests/getUnauthenticatedMatch.tsx b/src/requests/getUnauthenticatedMatch.tsx
index 1f507781..06264fc6 100644
--- a/src/requests/getUnauthenticatedMatch.tsx
+++ b/src/requests/getUnauthenticatedMatch.tsx
@@ -1,6 +1,7 @@
import {
DATA_URL,
PROCEDURES,
+ ProfileTypes,
SportTypes,
} from 'config'
@@ -14,23 +15,32 @@ type Team = {
}
export type UnauthenticatedMatch = {
- date: string,
- live: boolean,
- team1: Team,
- team2: Team,
+ date?: string,
+ live?: boolean,
+ team1?: Team,
+ team2?: Team,
tournament: {
name_eng: string,
name_rus: string,
},
} | null
-export const getUnauthenticatedMatch = (sportId: SportTypes, matchId: number)
+export const getUnauthenticatedMatch = (
+ sportId: SportTypes,
+ matchId: number,
+ profileType?: ProfileTypes,
+)
: Promise => {
const config = {
body: {
params: {
- _p_match_id: matchId,
+ _p_match_id: profileType === ProfileTypes.MATCHES
+ ? matchId
+ : null,
_p_sport: sportId,
+ _p_tournament_id: profileType === ProfileTypes.TOURNAMENTS
+ ? matchId
+ : null,
},
proc,
},