post base 64 with submitUserData function

pull/7/head
Suvodip 2024-05-16 21:22:07 +05:30
parent 04500f43d6
commit 17538eb91c
1 changed files with 17 additions and 16 deletions

View File

@ -472,27 +472,28 @@ import Layout from '../../layouts/Layout.astro';
// 'game_start' : gameStartTime, // 'game_start' : gameStartTime,
}; };
console.log(userData); console.log(userData);
fetch(`https://save-game-data.teachertrainingchennai.in/saveGameData`, {
fetch(`https://save-game-data.teachertrainingchennai.in/saveGameData`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type' : 'application/json' 'Content-Type' : 'application/json'
}, },
body: JSON.stringify(userData) body: JSON.stringify(userData)
}) })
.then(response => { .then(response => {
if(response.ok){ if(response.ok){
console.log('Data Saved', response) console.log('Data Saved', response)
} else{ } else{
// console.log('Something Wrong', response) // console.log('Something Wrong', response)
} }
}) })
.catch(error => { .catch(error => {
console.error('An error occured', error) console.error('An error occured', error)
}); });
// Clear the drawing // Clear the drawing
// graphics.clear(); // graphics.clear();
}); });
}; };
// function captureSnapshot(drawingZone) { // function captureSnapshot(drawingZone) {
// submitButton.setVisible(false); // submitButton.setVisible(false);