Skip to content

Instantly share code, notes, and snippets.

@zisra
Created September 26, 2023 16:40
Show Gist options
  • Save zisra/33314a86a6346ecb16559b2df4008fa1 to your computer and use it in GitHub Desktop.
Save zisra/33314a86a6346ecb16559b2df4008fa1 to your computer and use it in GitHub Desktop.
const lessonUUID = window.location.pathname.split("/")[2];
const sleep = (m) => new Promise((r) => setTimeout(r, m));
fetch(
`https://api.garbanzo.io/api/assignment/${lessonUUID}?localized_date_time=2023-09-14%2011:31:06`,
{
headers: {
authorization: localStorage.getItem("auth._token.local"),
},
method: "GET",
},
).then(async (res) => {
const { data } = await res.json();
for (step of data.steps) {
const lesson = await fetch(
`https://api.garbanzo.io/api/assignment/${lessonUUID}/step/${step.uuid}/`,
{
headers: {
authorization: localStorage.getItem("auth._token.local"),
},
method: "POST",
},
);
const lessonData = await lesson.json();
if (lessonData.message) {
console.log(lessonData.message);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment