feat(extension): submit code to server
All checks were successful
Publish docker image / Publish (push) Successful in 2m22s

This commit is contained in:
Ashhhleyyy 2024-02-18 17:33:36 +00:00
parent 72a0edb26c
commit 33fc26e0bc
Signed by: ash
GPG key ID: 83B789081A0878FB
2 changed files with 19 additions and 2 deletions

View file

@ -39,7 +39,23 @@ function interceptSubmit(details) {
}
console.log('request for activity', activityId, 'the code', code, 'was', codeCorrect ? 'correct' : 'incorrect');
// TODO: Send data to server.
const query = new URLSearchParams({
date: activity.date,
time: activity.time,
activity: activity.name,
space: activity.space,
});
fetch('https://aci-api.ashhhleyyy.dev/api/codes?' + query, {
headers: {
'content-type': 'application/json',
},
body: JSON.stringify({
code: activity.code,
success: codeCorrect,
}),
}).then(res => console.log('submitted code: ', res)).error(e => console.error('failed to submit code', e'));
}
function interceptCode(details) {

View file

@ -1 +1,2 @@
this.SERVER_URL = 'https://aci-api.ashhhleyyy.dev';
//this.SERVER_URL = 'https://aci-api.ashhhleyyy.dev';
this.SERVER_URL = 'http://localhost:8000';