WIP: Fix issue #285
This commit is contained in:
parent
60f1ddb89e
commit
cf475c26c9
1 changed files with 1 additions and 0 deletions
|
@ -34,6 +34,7 @@ generateVanillaJSWith opts req = "\n" <>
|
||||||
<> " xhr.open('" <> method <> "', " <> url <> ", true);\n"
|
<> " xhr.open('" <> method <> "', " <> url <> ", true);\n"
|
||||||
<> reqheaders
|
<> reqheaders
|
||||||
<> " xhr.setRequestHeader(\"Accept\",\"application/json\");\n"
|
<> " xhr.setRequestHeader(\"Accept\",\"application/json\");\n"
|
||||||
|
<> (if isJust (req ^. reqBody) then " xhr.setRequestHeader(\"Content-Type\",\"application/json\");\n" else "")
|
||||||
<> " xhr.onreadystatechange = function (e) {\n"
|
<> " xhr.onreadystatechange = function (e) {\n"
|
||||||
<> " if (xhr.readyState == 4) {\n"
|
<> " if (xhr.readyState == 4) {\n"
|
||||||
<> " var value = JSON.parse(xhr.responseText);\n"
|
<> " var value = JSON.parse(xhr.responseText);\n"
|
||||||
|
|
Loading…
Reference in a new issue