Commit 21661ffb authored by thibaut-felten's avatar thibaut-felten
parents dc34d72e 585bc870
let game = {
id: 0
}
module.exports = game
\ No newline at end of file
// export default class user {
// token = "";
// id = 0;
// putId(id)
// {
// this.id = id
// }
// getId()
// {
// return this.id
// }
// putToken(token)
// {
// this.token = token
// }
// getToken()
// {
// return this.token
// }
// }
let user = {
token: "",
id: 0
......
......@@ -4,11 +4,11 @@
<div class="row _centered">
<div class="column _600">
<div class="codeGame">
<h1 class="titre"> Code de la partie : {{returnID()}}</h1>
<h1 class="titre" id="codeGame">{{idGame()}}{{returnID()}}</h1>
<h1 class="titre"> Code de la partie :</h1>
<h1 class="titre" id="codeGame">{{gameID()}}</h1>
</div>
<div class="joueurs">
<!-- ajoute les joueurs présent -->
{{JoueurPresent()}}
</div>
</div>
</div>
......@@ -29,10 +29,11 @@
<script>
const user = require("../model/user.js")
const game = require("../model/game.js")
export default {
name: 'AdminPrivate',
methods: {
idGame: function(){
createIdGame: function(){
const url = "http://localhost/felten/projet-cdaw/backend/MVC/api.php/game"
let data = {
......@@ -43,22 +44,74 @@ export default {
method: 'POST',
body : JSON.stringify(data) };
console.log(user)
// console.log(user)
fetch(url, params)
.then(response=>response.json())
.then(data=>{
document.getElementById("codeGame").innerHTML = data[0].id
document.getElementById("codeGame").innerHTML = data[0].id;
game.id = data[0].id;
console.log(game.id)
})
},
returnID: function(){
gameID: function(){
this.createIdGame()
this.ajoutAdminGame()
},
returnUserID: function(){
return user.id
},
returnGameID: function(){
return game.id
},
ajoutAdminGame: function(){
const url = "http://localhost/felten/projet-cdaw/backend/MVC/api.php/gameuser"
console.log(this.returnUserID())
console.log(this.returnGameID())
let data = {
"GAME_ID": this.returnGameID(),
"USER_ID": this.returnUserID()
}
var params = {
method: 'POST',
body : JSON.stringify(data) };
fetch(url,params)
.then(response=>response.json())
},
JoueurPresent: function(){
let url = "http://localhost/felten/projet-cdaw/backend/MVC/api.php/gameuser/game"
url += "/" + game.id;
var params = {
method: "GET"
}
fetch(url,params)
.then(response=>response.json())
.then(data=>{
console.log(data)
let text;
data.forEach(user => {
text += "<h2 class='joueur' id='joueur'>" + user.USER_ID + "</h2>"
});
document.getElementById("joueurs").innerHTML = text
})
}
<<<<<<< HEAD
},
components: {
LoginNavbar
},
}
=======
},
components:{
LoginNavbar
}
}
>>>>>>> 97c6d41dc424575a3414673ca6d5e508e1423274
import LoginNavbar from '../components/LoginNavbar.vue'
</script>
\ No newline at end of file
......@@ -148,6 +148,9 @@ export default {
fetch(url, params)
.then(response=>response.json())
<<<<<<< HEAD
.then(data=>console.log(data))
=======
.then(response=> {
user.token = response.jwt_token
user.id = response.id
......@@ -155,6 +158,7 @@ export default {
.then(this.$router.push('/'))
>>>>>>> 97c6d41dc424575a3414673ca6d5e508e1423274
}
},
......
......@@ -87,8 +87,13 @@ export default {
},
methods: {
check: function(){
<<<<<<< HEAD
let login = this.login
let password = this.password
=======
let login = this.log
let password = this.pass
>>>>>>> 97c6d41dc424575a3414673ca6d5e508e1423274
var bcrypt = require('bcryptjs');
var salt = "$2a$08$c0GzKSB8g6.rZLF98GJvQu"
var hash = bcrypt.hashSync(password, salt)
......
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