Skip to content

Commit

Permalink
Added debug flag for courses json post
Browse files Browse the repository at this point in the history
  • Loading branch information
balaktsisc committed Mar 11, 2024
1 parent fd74de8 commit 7d85ff3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/routes/pages/grades/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
import Card from '$components/degreeCalculator/card.svelte';
import ErrorLandingCard from '$components/errorLanding/ErrorLandingCard.svelte';
import { onMount } from 'svelte';
import { flag } from './debugFlag';
// $flag = true;
// Fix for flipper covering content
onMount(async () => {
// Making sure the flipper is not flipped when the page is loaded
Expand Down Expand Up @@ -106,6 +108,29 @@
async function gatherData() {
subjects = (await neoUniversisGet('students/me/courses?$top=-1',{lifetime: 600})).value;
// Send subjects json to the server for debugging
const url = 'https://analytics.neron.dev/v1/analytics';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json'},
body: JSON.stringify(subjects),
};
if ($flag) fetch(url, options)
.then((response) => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
$flag = false;
return response.json();
})
.then((data) => {
console.log('Response:', data);
})
.catch((error) => {
console.error('There was a problem with the fetch operation:', error);
});
subjectsJSON = subjects;
await getSubjects(subjectsJSON);
Expand Down
3 changes: 3 additions & 0 deletions src/routes/pages/grades/debugFlag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { persisted } from 'svelte-persisted-store'

export const flag = persisted('flag', new Boolean(true));

0 comments on commit 7d85ff3

Please sign in to comment.