Skip to content

Commit

Permalink
Remove backslashes from api addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
guzel.khuziakhmetova committed Aug 21, 2024
1 parent 7da578b commit 7379ebb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions client/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,41 @@ import { PlayerSessionData, GameSession } from '../utils/types';
import { apiUrl } from "../utils/config";

export const joinRoom = async (sessionId: string, playerName: string): Promise<void> => {
const response = await axios.post<void>(`${apiUrl}/api/Player/JoinRoom/${sessionId}`, { playername: playerName });
const response = await axios.post<void>(`${apiUrl}api/Player/JoinRoom/${sessionId}`, { playername: playerName });
return response.data;
};

export const getScores = async (): Promise<PlayerSessionData[]> => {
const response = await axios.get<PlayerSessionData[]>(`${apiUrl}/Score/GetScores`);
const response = await axios.get<PlayerSessionData[]>(`${apiUrl}Score/GetScores`);
return response.data;
};

export const addScores = async (sessionId: string, playerId: string, name: string, score: number): Promise<void> => {
const response = await axios.post<void>(`${apiUrl}/Score/AddScores`, { sessionId, id: playerId, name, score });
const response = await axios.post<void>(`${apiUrl}Score/AddScores`, { sessionId, id: playerId, name, score });
return response.data;
};

export const createSession = async (name: string): Promise<GameSession> => {
const response = await axios.post<GameSession>(`${apiUrl}/Session/CreateSession`, { name });
const response = await axios.post<GameSession>(`${apiUrl}Session/CreateSession`, { name });
return response.data;
};

export const getAllSessions = async (): Promise<GameSession[]> => {
const response = await axios.get<GameSession[]>(`${apiUrl}/Session/GetAllSessions`);
const response = await axios.get<GameSession[]>(`${apiUrl}Session/GetAllSessions`);
return response.data;
};

export const getSessionById = async (sessionId: string): Promise<GameSession> => {
const response = await axios.get<GameSession>(`${apiUrl}/Session/GetSessionById/${sessionId}`);
const response = await axios.get<GameSession>(`${apiUrl}Session/GetSessionById/${sessionId}`);
return response.data;
};

export const startGame = async (sessionId: string): Promise<GameSession> => {
const response = await axios.post<GameSession>(`${apiUrl}/Session/Startgame`, { sessionId });
const response = await axios.post<GameSession>(`${apiUrl}Session/Startgame`, { sessionId });
return response.data;
};

export const endGame = async (sessionId: string): Promise<void> => {
const response = await axios.post<void>(`${apiUrl}/Session/EndGame`, { sessionId });
const response = await axios.post<void>(`${apiUrl}Session/EndGame`, { sessionId });
return response.data;
};
2 changes: 1 addition & 1 deletion client/src/api/gamehub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7379ebb

Please sign in to comment.