work successfull message
This commit is contained in:
@@ -2,6 +2,8 @@ const queryString = window.location.search;
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const userId = urlParams.get('userId');
|
||||
let gameId;
|
||||
let submitNotic;
|
||||
|
||||
console.log(userId);
|
||||
let startTime = Date.now();
|
||||
|
||||
@@ -50,10 +52,10 @@ function submitUserData(drawingZone) {
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
const link = document.createElement('a');
|
||||
link.href = image.src;
|
||||
link.download = 'my_drawing.png';
|
||||
link.click();
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = 'my_drawing.png';
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}else if( gameType[0] == "guided-tracing"){
|
||||
@@ -65,10 +67,10 @@ function submitUserData(drawingZone) {
|
||||
image.style.paddingLeft = '2px';
|
||||
document.body.appendChild(image);
|
||||
// Download the snapshot as an image
|
||||
const link = document.createElement('a');
|
||||
link.href = image.src;
|
||||
link.download = `guided-tracing-${gameId}.png`;
|
||||
link.click();
|
||||
// const link = document.createElement('a');
|
||||
// link.href = image.src;
|
||||
// link.download = `guided-tracing-${gameId}.png`;
|
||||
// link.click();
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}
|
||||
@@ -85,7 +87,7 @@ function submitUserData(drawingZone) {
|
||||
// 'starts': formattedDateTime,
|
||||
// 'game_start' : gameStartTime,
|
||||
};
|
||||
// console.log(userData);
|
||||
console.log(userData);
|
||||
|
||||
fetch(`https://phaser-game-api.s38.siliconpin.com/save-data`, {
|
||||
method: 'POST',
|
||||
@@ -96,9 +98,12 @@ function submitUserData(drawingZone) {
|
||||
})
|
||||
.then(response => {
|
||||
if(response.ok){
|
||||
// console.log('Data Saved', response)
|
||||
console.log('Data Saved', response.status)
|
||||
if(response.status == 200){
|
||||
submitNotic.setVisible(true);
|
||||
}
|
||||
} else{
|
||||
// console.log('Something Wrong', response)
|
||||
// console.log('Something Wrong', response)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user