generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into fix/webapp/game
# Conflicts: # webapp/src/components/game/Game.js # webapp/src/tests/Dashboard.test.js
- Loading branch information
Showing
4 changed files
with
62 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
import AuthManager from "components/auth/AuthManager"; | ||
|
||
const authManager = new AuthManager(); | ||
|
||
export async function isActive() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/is-active"); | ||
} | ||
|
||
export async function getCurrentGame() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/play"); | ||
} | ||
|
||
export async function gameCategories() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/question-categories"); | ||
} | ||
|
||
export async function gameModes() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/gamemodes"); | ||
} | ||
|
||
export async function newGame(lang, gamemode, customGameDto) { | ||
let requestAnswer; | ||
if (gamemode === "CUSTOM") { | ||
requestAnswer = await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/play?lang=" + lang + "&gamemode=" + gamemode, customGameDto); | ||
} else { | ||
requestAnswer = await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/play?lang=" + lang + "&gamemode=" + gamemode); | ||
} | ||
|
||
return requestAnswer; | ||
} | ||
|
||
export async function startRound(gameId) { | ||
return await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/startRound"); | ||
} | ||
|
||
export async function getCurrentQuestion(gameId) { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/question"); | ||
} | ||
|
||
export async function changeLanguage(gameId, language) { | ||
await authManager.getAxiosInstance().put(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/language?language=" + language); | ||
} | ||
|
||
export async function answerQuestion(gameId, aId) { | ||
return await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/answer", {answer_id:aId}); | ||
} | ||
|
||
export async function getGameDetails(gameId) { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/details"); | ||
} | ||
import AuthManager from "components/auth/AuthManager"; | ||
|
||
const authManager = new AuthManager(); | ||
|
||
export async function isActive() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/is-active"); | ||
} | ||
|
||
export async function getCurrentGame() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/play"); | ||
} | ||
|
||
export async function gameCategories() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/question-categories"); | ||
} | ||
|
||
export async function gameModes() { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/gamemodes"); | ||
} | ||
|
||
export async function newGame(lang, gamemode, customGameDto) { | ||
let requestAnswer; | ||
if (gamemode === "CUSTOM") { | ||
requestAnswer = await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/play?lang=" + lang + "&gamemode=" + gamemode, customGameDto); | ||
} else { | ||
requestAnswer = await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/play?lang=" + lang + "&gamemode=" + gamemode); | ||
} | ||
|
||
return requestAnswer; | ||
} | ||
|
||
export async function startRound(gameId) { | ||
return await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/startRound"); | ||
} | ||
|
||
export async function getCurrentQuestion(gameId) { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/question"); | ||
} | ||
|
||
export async function changeLanguage(gameId, language) { | ||
await authManager.getAxiosInstance().put(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/language?language=" + language); | ||
} | ||
|
||
export async function answerQuestion(gameId, aId) { | ||
return await authManager.getAxiosInstance().post(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/answer", {answer_id:aId}); | ||
} | ||
|
||
export async function getGameDetails(gameId) { | ||
return await authManager.getAxiosInstance().get(process.env.REACT_APP_API_ENDPOINT + "/games/" + gameId + "/details"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters