aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/bug-notifier.js
blob: bfb3e97703cecff93fe9987eda8007c7041e86d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class BugNotifier {
  notify (uri, message) {
    return postData(uri, message)
  }
}

function postData(uri, data) {
  return fetch(uri, {
    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
  })
}

const notifier = new BugNotifier()

module.exports = notifier