Skip to content

Instantly share code, notes, and snippets.

@cliftonlabrum
Created May 15, 2022 03:56
Show Gist options
  • Save cliftonlabrum/726e6169f4f9c38ba641b0dfd6101986 to your computer and use it in GitHub Desktop.
Save cliftonlabrum/726e6169f4f9c38ba641b0dfd6101986 to your computer and use it in GitHub Desktop.
SvelteKit Component Example with Schoology
<script>
async function sample(){
console.log('Hi!')
let res = await fetch('https://api.schoology.com/v1/messages/inbox', {
method: 'GET',
headers:{
'Authorization': '[OAuth header...]',
'Accept': 'text/xml;q=1.0,application/json;q=0.0',
'Host': 'api.schoology.com',
'Content-Type': 'text/xml'
}
})
console.log('Here is the API response:')
console.log(res)
}
</script>
<div>
<a href="#start" on:click={sample}>Start</a>
</div>
<style>
div{
margin:50px;
}
a{
background:blue;
color:white;
padding:5px 10px;
border-radius: 5px;
text-decoration: none;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment