diff --git a/client/src/api/api.ts b/client/src/api/api.ts index a50cae6..6ad20f9 100644 --- a/client/src/api/api.ts +++ b/client/src/api/api.ts @@ -4,41 +4,41 @@ import { PlayerSessionData, GameSession } from '../utils/types'; import { apiUrl } from "../utils/config"; export const joinRoom = async (sessionId: string, playerName: string): Promise => { - const response = await axios.post(`${apiUrl}/api/Player/JoinRoom/${sessionId}`, { playername: playerName }); + const response = await axios.post(`${apiUrl}api/Player/JoinRoom/${sessionId}`, { playername: playerName }); return response.data; }; export const getScores = async (): Promise => { - const response = await axios.get(`${apiUrl}/Score/GetScores`); + const response = await axios.get(`${apiUrl}Score/GetScores`); return response.data; }; export const addScores = async (sessionId: string, playerId: string, name: string, score: number): Promise => { - const response = await axios.post(`${apiUrl}/Score/AddScores`, { sessionId, id: playerId, name, score }); + const response = await axios.post(`${apiUrl}Score/AddScores`, { sessionId, id: playerId, name, score }); return response.data; }; export const createSession = async (name: string): Promise => { - const response = await axios.post(`${apiUrl}/Session/CreateSession`, { name }); + const response = await axios.post(`${apiUrl}Session/CreateSession`, { name }); return response.data; }; export const getAllSessions = async (): Promise => { - const response = await axios.get(`${apiUrl}/Session/GetAllSessions`); + const response = await axios.get(`${apiUrl}Session/GetAllSessions`); return response.data; }; export const getSessionById = async (sessionId: string): Promise => { - const response = await axios.get(`${apiUrl}/Session/GetSessionById/${sessionId}`); + const response = await axios.get(`${apiUrl}Session/GetSessionById/${sessionId}`); return response.data; }; export const startGame = async (sessionId: string): Promise => { - const response = await axios.post(`${apiUrl}/Session/Startgame`, { sessionId }); + const response = await axios.post(`${apiUrl}Session/Startgame`, { sessionId }); return response.data; }; export const endGame = async (sessionId: string): Promise => { - const response = await axios.post(`${apiUrl}/Session/EndGame`, { sessionId }); + const response = await axios.post(`${apiUrl}Session/EndGame`, { sessionId }); return response.data; }; diff --git a/client/src/api/gamehub.ts b/client/src/api/gamehub.ts index cbadf4e..52e35e8 100644 --- a/client/src/api/gamehub.ts +++ b/client/src/api/gamehub.ts @@ -14,7 +14,7 @@ export class GameHubClient { constructor() { this.connection = new signalR.HubConnectionBuilder() - .withUrl(`${apiUrl}/hub`, { + .withUrl(`${apiUrl}hub`, { withCredentials: false, // CORS policy }) .configureLogging(signalR.LogLevel.Information)