Commit 5085fdff authored by thibaut-felten's avatar thibaut-felten
parents a30174ac 6b7bb5c0
...@@ -36,9 +36,6 @@ class ResultController extends Controller { ...@@ -36,9 +36,6 @@ class ResultController extends Controller {
case 'OPTIONS': case 'OPTIONS':
return Response::okresponse(json_encode("OPTIONS")); return Response::okresponse(json_encode("OPTIONS"));
// $data = json_decode(file_get_contents("php://input"),TRUE);
// return $this->deleteLine($data);
// break;
} }
return Response::errorResponse("unsupported parameters or method in game"); return Response::errorResponse("unsupported parameters or method in game");
......
...@@ -20,8 +20,6 @@ class Online extends Model { ...@@ -20,8 +20,6 @@ class Online extends Model {
$idmin = $res[0]->USER_ID; $idmin = $res[0]->USER_ID;
if($id == $idmin){ if($id == $idmin){
$game = Online::getIdGame(); $game = Online::getIdGame();
// print_r($game);
// exit;
if(count($game) == 1){ if(count($game) == 1){
Online::deleteUserOnline(array(":id" => $id)); Online::deleteUserOnline(array(":id" => $id));
Game::addUserGame(array(":GAME_ID" => $game[0]->GAME_ID, ":USER_ID" => $id)); Game::addUserGame(array(":GAME_ID" => $game[0]->GAME_ID, ":USER_ID" => $id));
...@@ -30,8 +28,6 @@ class Online extends Model { ...@@ -30,8 +28,6 @@ class Online extends Model {
else { else {
$idgame = Game::createGame(array( ":GAME_DESC" => "Desc", ":private" => "0")); $idgame = Game::createGame(array( ":GAME_DESC" => "Desc", ":private" => "0"));
Online::deleteUserOnline(array(":id" => $id)); Online::deleteUserOnline(array(":id" => $id));
// print_r($idgame);
// exit;
Game::addUserGame(array(":GAME_ID" => $idgame[0]->id, ":USER_ID" => $id)); Game::addUserGame(array(":GAME_ID" => $idgame[0]->id, ":USER_ID" => $id));
return $idgame[0]->id; return $idgame[0]->id;
......
...@@ -29,10 +29,6 @@ export default { ...@@ -29,10 +29,6 @@ export default {
}, },
} }
console.log(user.id);
</script> </script>
<style scoped> <style scoped>
......
...@@ -4,7 +4,7 @@ import router from './router' ...@@ -4,7 +4,7 @@ import router from './router'
Vue.config.productionTip = false Vue.config.productionTip = false
sessionStorage.setItem('APIURL', 'http://localhost/projet-cdaw/backend/MVC/api.php') sessionStorage.setItem('APIURL', 'http://localhost/felten/projet-cdaw/backend/MVC/api.php')
new Vue({ new Vue({
router, router,
......
...@@ -67,7 +67,6 @@ export default { ...@@ -67,7 +67,6 @@ export default {
let response = await fetch(url, params) let response = await fetch(url, params)
let result = await response.json() let result = await response.json()
console.log(result)
document.getElementById("codeGame").innerHTML = result[0].id; document.getElementById("codeGame").innerHTML = result[0].id;
game.id = result[0].id; game.id = result[0].id;
// console.log(game.id) // console.log(game.id)
...@@ -88,7 +87,6 @@ export default { ...@@ -88,7 +87,6 @@ export default {
}, },
ajoutAdminGame: async function(){ ajoutAdminGame: async function(){
const url = sessionStorage.getItem('APIURL') + "/gameuser" const url = sessionStorage.getItem('APIURL') + "/gameuser"
console.log(game.id)
let data = { let data = {
"GAME_ID": game.id, "GAME_ID": game.id,
"USER_ID": user.id, "USER_ID": user.id,
...@@ -102,7 +100,6 @@ export default { ...@@ -102,7 +100,6 @@ export default {
}, },
JoueurPresent: async function(){ JoueurPresent: async function(){
let url = sessionStorage.getItem('APIURL') + "/gameuser/game" let url = sessionStorage.getItem('APIURL') + "/gameuser/game"
console.log(game.id)
url += "/" + game.id; url += "/" + game.id;
var params = { var params = {
method: "GET" method: "GET"
...@@ -119,7 +116,6 @@ export default { ...@@ -119,7 +116,6 @@ export default {
return return
} }
setTimeout(() => {if(game.id){this.JoueurPresent()}}, 3000) setTimeout(() => {if(game.id){this.JoueurPresent()}}, 3000)
// setInterval(() => {if(game.id){this.JoueurPresent()}}, 3000)
}, },
retour: async function() { retour: async function() {
......
...@@ -148,9 +148,6 @@ export default { ...@@ -148,9 +148,6 @@ export default {
let rock = this.rock let rock = this.rock
let paper = this.paper let paper = this.paper
let scissors = this.scissors let scissors = this.scissors
console.log("ID : " + user.id)
console.log("TOKEN : " + user.token)
await fetch( await fetch(
sessionStorage.getItem('APIURL') + `/user/${user.id}`, sessionStorage.getItem('APIURL') + `/user/${user.id}`,
{ {
......
...@@ -144,8 +144,6 @@ export default { ...@@ -144,8 +144,6 @@ export default {
method: 'POST', method: 'POST',
body : JSON.stringify(data) }; body : JSON.stringify(data) };
console.log(params.body.lastname)
fetch(url, params) fetch(url, params)
.then(response=>response.json()) .then(response=>response.json())
.then(response=> { .then(response=> {
......
...@@ -76,8 +76,7 @@ export default { ...@@ -76,8 +76,7 @@ export default {
method: 'POST', method: 'POST',
body : JSON.stringify(data) }; body : JSON.stringify(data) };
game.id=this.idgame; game.id=this.idgame;
let response = await fetch(url, params) await fetch(url, params)
console.log(response)
this.$router.push("/playerPrivate") this.$router.push("/playerPrivate")
} }
}, },
......
...@@ -62,12 +62,9 @@ export default { ...@@ -62,12 +62,9 @@ export default {
method: "GET" method: "GET"
} }
) )
console.log(res)
const result = await res.json() const result = await res.json()
console.log(result)
if (result.length >= 1) { if (result.length >= 1) {
game.id = result game.id = result
console.log(result)
this.goGame(result) this.goGame(result)
return return
} }
...@@ -78,7 +75,6 @@ export default { ...@@ -78,7 +75,6 @@ export default {
goGame: async function(gameID) { goGame: async function(gameID) {
let url = sessionStorage.getItem('APIURL') + "/gameuser/game" let url = sessionStorage.getItem('APIURL') + "/gameuser/game"
console.log(gameID)
url += "/" + gameID; url += "/" + gameID;
var params = { var params = {
method: "GET" method: "GET"
......
...@@ -38,19 +38,16 @@ export default { ...@@ -38,19 +38,16 @@ export default {
}, },
JoueurPresent: async function(){ JoueurPresent: async function(){
let url = sessionStorage.getItem('APIURL') + "/gameuser/game" let url = sessionStorage.getItem('APIURL') + "/gameuser/game"
console.log(game.id)
url += "/" + game.id; url += "/" + game.id;
var params = { var params = {
method: "GET" method: "GET"
} }
let response = await fetch(url,params) let response = await fetch(url,params)
let result = await response.json() let result = await response.json()
console.log(result)
let text = ""; let text = "";
result.forEach(user => { result.forEach(user => {
text += `<tr><h2 class='joueur' id='joueur'>${user.USER_ID}</h2></tr>` text += `<tr><h2 class='joueur' id='joueur'>${user.USER_ID}</h2></tr>`
}); });
console.log(text)
document.getElementById("joueurs").innerHTML = text document.getElementById("joueurs").innerHTML = text
if(result.length >= 2){ if(result.length >= 2){
this.$router.push(`/game/${game.id}`) this.$router.push(`/game/${game.id}`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment