Created
May 24, 2019 08:02
-
-
Save linonetwo/6ca147d2c52da2258cebfa50e4c720be to your computer and use it in GitHub Desktop.
ES6 fetch #api with headers and body
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
fetch(`http://localhost:${env.ankiPort || 8765}`, { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ action: 'addNote', version: 6, params }), | |
}).catch(error => { | |
pluginContext.console.log('error', 'failed adding to anki', { error, errorString: String(error) }); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment