Compare commits
2 Commits
0433e4695e
...
256f0b7684
Author | SHA1 | Date | |
---|---|---|---|
256f0b7684 | |||
409e13277e |
@ -1,3 +1,4 @@
|
||||
import { Constants } from '@/constants/Constants'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { useChallengeActions, useDownloadChallengeActions } from '@/hooks/useChallengeActions'
|
||||
import { useDownloadChallenges } from '@/hooks/useChallenges'
|
||||
@ -31,7 +32,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
headers: { "Authorization": `Bearer ${auth.token}` }}
|
||||
).then(resp => resp.json()),
|
||||
enabled: isAuthValid(auth),
|
||||
refetchInterval: 5000,
|
||||
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (gameQuery.isSuccess && gameQuery.data)
|
||||
@ -44,7 +45,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
headers: { "Authorization": `Bearer ${auth.token}` }}
|
||||
).then(resp => resp.json()),
|
||||
enabled: isAuthValid(auth) && !!game.playerId,
|
||||
refetchInterval: 5000,
|
||||
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (playerQuery.isSuccess && playerQuery.data) {
|
||||
@ -60,7 +61,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
).then(resp => resp.json()),
|
||||
enabled: isAuthValid(auth) && !!game.playerId,
|
||||
initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } },
|
||||
refetchInterval: 5000,
|
||||
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (trainsQuery.isSuccess && trainsQuery.data)
|
||||
@ -74,7 +75,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
).then(resp => resp.json()),
|
||||
enabled: isAuthValid(auth),
|
||||
initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } },
|
||||
refetchInterval: 5000,
|
||||
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (challengesQuery.isSuccess && challengesQuery.data) {
|
||||
@ -91,7 +92,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
headers: { "Authorization": `Bearer ${auth.token}` }}
|
||||
).then(resp => resp.json()),
|
||||
enabled: isAuthValid(auth) && !!game.playerId,
|
||||
refetchInterval: 5000,
|
||||
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (moneyUpdatesQuery.isSuccess && moneyUpdatesQuery.data)
|
||||
|
@ -8,6 +8,7 @@ import { useQuery } from '@tanstack/react-query'
|
||||
import { isAuthValid } from '@/utils/features/auth/authSlice'
|
||||
import { socket } from '@/utils/socket'
|
||||
import { PlayerLocation } from '@/utils/features/location/locationSlice'
|
||||
import { Constants } from '@/constants/Constants'
|
||||
|
||||
export default function GeolocationProvider({ children }: { children: ReactNode }) {
|
||||
useStartGeolocationServiceEffect()
|
||||
@ -43,7 +44,7 @@ export default function GeolocationProvider({ children }: { children: ReactNode
|
||||
}).then(resp => resp.json()),
|
||||
initialData: [],
|
||||
enabled: isAuthValid(auth),
|
||||
refetchInterval: 5000,
|
||||
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (lastLocationsQuery.isSuccess && lastLocationsQuery.data)
|
||||
|
@ -1,3 +1,4 @@
|
||||
export const Constants = {
|
||||
MIN_DELAY_LOCATION_SENT: 20
|
||||
MIN_DELAY_LOCATION_SENT: 20,
|
||||
QUERY_REFETCH_INTERVAL: 15,
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { io } from 'socket.io-client'
|
||||
|
||||
export const socket = io("http://192.168.1.198:3000", {
|
||||
export const socket = io(process.env.EXPO_PUBLIC_TRAINTRAPE_MOI_SERVER, {
|
||||
reconnection: true,
|
||||
})
|
||||
|
@ -1,3 +1,4 @@
|
||||
DATABASE_URL="postgres://username:password@localhost:5432/traintrape-moi"
|
||||
JWT_SECRET="CHANGE_ME"
|
||||
API_GLOBAL_PREFIX="api"
|
||||
API_HOSTNAME="traintrape-moi.luemy.eu"
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { SubscribeMessage, WebSocketGateway, WebSocketServer } from '@nestjs/websockets'
|
||||
import { Server, Socket } from 'socket.io'
|
||||
|
||||
@WebSocketGateway()
|
||||
@WebSocketGateway({
|
||||
cors: { allowedHeaders: process.env.API_HOSTNAME },
|
||||
})
|
||||
export class GeolocationsGateway {
|
||||
@WebSocketServer()
|
||||
server: Server
|
||||
|
Loading…
x
Reference in New Issue
Block a user