From 17538eb91cf355669229643e721be72b293fe67b Mon Sep 17 00:00:00 2001 From: Suvodip Date: Thu, 16 May 2024 21:22:07 +0530 Subject: [PATCH] post base 64 with submitUserData function --- src/pages/drawing/index.astro | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/pages/drawing/index.astro b/src/pages/drawing/index.astro index 12b9070..307cc8a 100644 --- a/src/pages/drawing/index.astro +++ b/src/pages/drawing/index.astro @@ -472,27 +472,28 @@ import Layout from '../../layouts/Layout.astro'; // 'game_start' : gameStartTime, }; console.log(userData); - fetch(`https://save-game-data.teachertrainingchennai.in/saveGameData`, { + + fetch(`https://save-game-data.teachertrainingchennai.in/saveGameData`, { 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) - }); - - // Clear the drawing - // graphics.clear(); - }); + }) + .then(response => { + if(response.ok){ + console.log('Data Saved', response) + } else{ + // console.log('Something Wrong', response) + } + }) + .catch(error => { + console.error('An error occured', error) + }); + + // Clear the drawing + // graphics.clear(); + }); }; // function captureSnapshot(drawingZone) { // submitButton.setVisible(false);