aboutsummaryrefslogblamecommitdiffstats
path: root/app/scripts/lib/bug-notifier.js
blob: 4d305b89408fa83df1e15dae4659145bf3408b59 (plain) (tree)
1
2
3
4
5
6
7
8
9
                   

                                 


   
                              
                     
                                                                   

                                                              
                                         


                                                    
    

 


                                  
 
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