diff --git a/extension/src/background.js b/extension/src/background.js index 1877e39..00b4bbd 100644 --- a/extension/src/background.js +++ b/extension/src/background.js @@ -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) { diff --git a/extension/src/config.js b/extension/src/config.js index 057a8d0..ca7ffa8 100644 --- a/extension/src/config.js +++ b/extension/src/config.js @@ -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';