File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,21 +24,20 @@ function handleErrors(response) {
2424 return response ;
2525}
2626
27- const sendEmails = ( ) => {
27+ const sendEmails = async ( ) => {
2828 const data = { templateName : 'emailTemplate' , percentOfEmails : '22' }
2929 alert ( 'Sending emails!' ) ;
3030
3131 // curl -H "Content-Type: application/json" http://localhost:8080/surveys/send -d "{"""templateName""":"""emailTemplate""","""percentOfEmails""":"""22"""}" -X POST
3232
33- const response = fetch ( 'http://localhost:8080/surveys/send' , {
33+ const response = await fetch ( 'http://localhost:8080/surveys/send' , {
3434 method : 'POST' ,
3535 cache : 'no-cache' ,
3636 headers : {
3737 'Accept' : 'application/json' ,
38- // 'Content-Type': 'application/json'
38+ 'Content-Type' : 'application/json'
3939 } ,
40- body : JSON . stringify ( { templateName : 'emailTemplate' , percentOfEmails : '22' } ) ,
41- data : null
40+ body : JSON . stringify ( { templateName : 'emailTemplate' , percentOfEmails : '22' } )
4241 } )
4342 . then ( handleErrors )
4443 . then ( response => { console . log ( response ) } )
You can’t perform that action at this time.
0 commit comments