This commit is contained in:
Suvodip
2024-06-15 19:29:27 +05:30
parent a8277e9aad
commit 2d6dbbf2b7
6 changed files with 230 additions and 160 deletions

View File

@@ -9,6 +9,7 @@ import Layout from '../../layouts/Layout.astro';
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
</main>
</Layout>
<script src="/saveGameData.js" is:inline></script>
<script is:inline>
const isMobile = window.innerWidth <= 768; // Define your mobile breakpoint as needed
const isTab = window.innerWidth > 768 && window.innerWidth <= 1416;
@@ -168,33 +169,33 @@ import Layout from '../../layouts/Layout.astro';
.catch(error => {
console.error('Error fetching initial data:', error);
});
const URL = window.location.href;
const gameName = URL.split('/');
let userData = {
'user': 'drawing@beanstalkedu.com',
'game_name': gameName[3],
'starts': formattedDateTime,
// 'game_start' : gameStartTime,
};
function submitUserData() {
fetch(`https://2016.dev2-cs.siliconpin.com/save/`, {
method: 'POST',
headers: {
'Content-Type' : 'application/json'
},
body: JSON.stringify(userData)
})
.then(response => {
if(response.ok){
// console.log('Data Saved', response)
} else{
// console.log('Something Wrong', response)
}
})
.catch(error => {
console.error('An error occured', error)
});
};
// console.log(gameType[0]);
// let userData = {
// 'user': 'drawing@beanstalkedu.com',
// 'game_name': gameName[3],
// 'starts': formattedDateTime,
// // 'game_start' : gameStartTime,
// };
// function submitUserData() {
// fetch(`https://2016.dev2-cs.siliconpin.com/save/`, {
// method: 'POST',
// headers: {
// 'Content-Type' : 'application/json'
// },
// body: JSON.stringify(userData)
// })
// .then(response => {
// if(response.ok){
// // console.log('Data Saved', response)
// } else{
// // console.log('Something Wrong', response)
// }
// })
// .catch(error => {
// console.error('An error occured', error)
// });
// };
// window.load
const borderBottom = this.add.graphics();
const x = 0; const y = 54;
@@ -231,7 +232,8 @@ import Layout from '../../layouts/Layout.astro';
// console.log('Clicked');
submitNotic.setVisible(true);
// windowLoad();
submitUserData();
// submitUserData();
submitUserData(this);
})
const textStyle = {font: 'bold 40px quicksand', fill: '#05b3a4',};
if(!isMobile){