2018-06-04 23:05:56 +02:00
|
|
|
class BugNotifier {
|
2018-06-04 23:21:46 +02:00
|
|
|
notify (uri, message) {
|
|
|
|
return postData(uri, message)
|
2018-06-04 23:05:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-04 23:21:46 +02:00
|
|
|
function postData(uri, data) {
|
2018-06-04 23:30:24 +02:00
|
|
|
return fetch(uri, {
|
2018-06-04 23:05:56 +02:00
|
|
|
body: JSON.stringify(data), // must match 'Content-Type' header
|
|
|
|
credentials: 'same-origin', // include, same-origin, *omit
|
|
|
|
headers: {
|
2018-06-05 00:10:51 +02:00
|
|
|
'content-type': 'application/json',
|
2018-06-04 23:05:56 +02:00
|
|
|
},
|
|
|
|
method: 'POST', // *GET, POST, PUT, DELETE, etc.
|
|
|
|
mode: 'cors', // no-cors, cors, *same-origin
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2018-06-04 23:59:46 +02:00
|
|
|
const notifier = new BugNotifier()
|
|
|
|
|
|
|
|
module.exports = notifier
|
2018-06-04 23:05:56 +02:00
|
|
|
|