Last active
March 12, 2020 20:06
-
-
Save jazzyjackson/562f6f5ef0abca39833bdf3c29f07b4d to your computer and use it in GitHub Desktop.
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
<!-- an example of using the kvetch function --> | |
<!-- https://github.com/jazzyjackson/kvetch.js --> | |
<script src="wherever you cloned this file/kvetch.js"> | |
<script> | |
kvetch.get('/', {anything: 'you want'}) | |
// becomes '/?anything=you%20want' | |
kvetch.post('/somedata', null, { | |
"key-1" : "some data you want to send as a JSON body", | |
"key-b" : "the headers and cookies and everything else are handled for you" | |
}).then(res => res.json()).then(data => /* any call to kvetch returns the fetch it invoked */) | |
var someSignUpSheet = new FormData() | |
someSignUpSheet.append('firstName','your') | |
someSignUpSheet.append('middleName','latest') | |
someSignUpSheet.append('lastName', 'identity') | |
kvetch.put('/signUp', {metadata: 'extra info'}, someSignUpSheet) | |
.then(()=> alert("success!")) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment