diff options
author | Dan Finlay <dan@danfinlay.com> | 2018-06-05 05:21:46 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2018-06-05 05:21:46 +0800 |
commit | fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2 (patch) | |
tree | 36eebb0cadf2434bbb18e64eb0b6a6abb9bfa35e /app/scripts/lib/bug-notifier.js | |
parent | 8fcaa2cf56936388ef8dfc528ecbd2354adb201e (diff) | |
download | tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.gz tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.tar.zst tangerine-wallet-browser-fd1ce4d741cc5992cc5d3d6109dc46cddf871ec2.zip |
Begin adding unconfigured notifier
Diffstat (limited to 'app/scripts/lib/bug-notifier.js')
-rw-r--r-- | app/scripts/lib/bug-notifier.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/scripts/lib/bug-notifier.js b/app/scripts/lib/bug-notifier.js new file mode 100644 index 000000000..d6a2ed2c9 --- /dev/null +++ b/app/scripts/lib/bug-notifier.js @@ -0,0 +1,24 @@ +class BugNotifier { + notify (uri, message) { + return postData(uri, message) + .then(data => console.log(data)) // JSON from `response.json()` call + .catch(error => console.error(error)) + } +} + +function postData(uri, data) { + + return fetch(url, { + body: JSON.stringify(data), // must match 'Content-Type' header + credentials: 'same-origin', // include, same-origin, *omit + headers: { + 'content-type': 'application/json' + }, + method: 'POST', // *GET, POST, PUT, DELETE, etc. + mode: 'cors', // no-cors, cors, *same-origin + }) + .then(response => response.json()) // parses response to JSON +} + +module.exports = BugNotifier + |