Created
May 15, 2022 03:56
-
-
Save cliftonlabrum/726e6169f4f9c38ba641b0dfd6101986 to your computer and use it in GitHub Desktop.
SvelteKit Component Example with Schoology
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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