change Ui

This commit is contained in:
Suvodip
2025-01-23 19:16:56 +05:30
parent 9809ca86d9
commit eb7d7e9da8
20 changed files with 2086 additions and 1003 deletions

View File

@@ -7,6 +7,8 @@
const gameVersion = urlParams.get('gameName');
const gameId = urlParams.get('id');
const spriteName = urlParams.get('spriteName');
const assignmentId = urlParams.get('assignmentId');
const worksheetId = urlParams.get('worksheetId');
let submitNotic;
let startTime = Date.now();
@@ -135,40 +137,62 @@ function submitUserData(drawingZone) {
.then(response => response.json())
.then(data => {
console.log('data from save gallery', data);
if(data.screenshotUrl){
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(userData)
})
.then(response => {
setTimeout(() => {
if (response.ok) {
if (response.status == 200) {
document.getElementById('saved-toast').classList.remove('hidden');
setTimeout(() => {
document.getElementById('saved-toast').classList.add('hidden');
}, 2000);
// console.log(response.status, " Data Saved Succesfully");
}
} else {
// console.log('Something went wrong', response);
}
}, 100);
})
.catch(error => {
console.error('An error occurred', error);
});
const userAnotherData = {
assignmentId: assignmentId,
worksheetId: worksheetId,
studentId: userId,
submissionFile: data.screenshotUrl,
};
const authToken = 'Bearer eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkZW50aXR5SWQiOiI2NjNjNGMzNjRiNmYzZjU0YmExZjcxMTUiLCJfaWQiOiI2NjNjNGMzNjBiOWYyZDk5MGQyNWYwYjMiLCJ0eXBlIjoiQUtBREVNWSIsImRldmljZUlkIjoiMDBqNXJtODl5b3BvNjh1a2Yyb2c5cTdoIn0sImlhdCI6MTczNjM5ODkwNCwiZXhwIjoxNzM3MDAzNzA0LCJpc3MiOiJidXp6T25lIn0.vhH0zTkVisnbK6n5aPgV3RrtmpP095Gtz6ayUc29XerEV-XPVhYwg06JQnm2FWGPtadEJ2Ea5z6_YNp5Kz9DENL9LxpYYuXRUOGvMEaVM5YZOYQ88viqxM7SIvxElIsc8cQeJr5v-4ov4MyOuXws7R5MDDO2PuzYdwaA52GXbQ0LO3aFGOQL7nWPKVYqFWCQe_T-1JphbsGStHivcmUy8_DAdjs0VpXFJKiQm6jcWQO3j3uOUJSi14af4ZvrUPkjIT92OOHiZTL7CUbbFt4yktnw3Gm2Fv6lS5pamSJpVJnGJQ6ebjd70IXnE49Mn9IK9AssnjTBh2DaNeVc0C1z9Q'; // Your token
fetch(`https://preschool-curriculum.in/api/one/v1/akademy/worksheet/submissions`, {
method: 'POST',
headers: {
'Content-Type' : 'application/json',
'Authorization' : authToken
},
body: JSON.stringify(userAnotherData)
})
.then(response => response.json())
.then(data => {
console.log('submissions api response', data)
})
.catch(error => {
console.error('An error occured', error)
})
}
})
.catch(error => {
console.error('An error occured', error);
})
// console.log(userData);
fetch(`https://api.teachertrainingkolkata.in/api/saveGameScore2`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(userData)
})
.then(response => {
setTimeout(() => {
if (response.ok) {
if (response.status == 200) {
document.getElementById('saved-toast').classList.remove('hidden');
setTimeout(() => {
document.getElementById('saved-toast').classList.add('hidden');
}, 2000);
// console.log(response.status, " Data Saved Succesfully");
}
} else {
// console.log('Something went wrong', response);
}
}, 100);
})
.catch(error => {
console.error('An error occurred', error);
});
// Clear the drawing
// graphics.clear();
});