Last active
May 12, 2019 00:11
-
-
Save localhostdotdev/3c3f9291c0703c9bf9d436da9679d755 to your computer and use it in GitHub Desktop.
Revisions
-
localhostdotdev revised this gist
May 12, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ post = (url, body) -> token = document.querySelector('meta[name="csrf-token"]').attributes.content.value fetch("#{url}.json", @@ -11,5 +11,5 @@ post = (url, options = {}) -> "X-CSRF-Token": token redirect: "follow" referrer: "no-referrer" body: body ).then (response) -> response.json() -
localhostdotdev revised this gist
May 12, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,5 @@ post = (url, options = {}) -> "X-CSRF-Token": token redirect: "follow" referrer: "no-referrer" body: options.body ).then (response) -> response.json() -
localhostdotdev created this gist
May 12, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ post = (url, options = {}) -> token = document.querySelector('meta[name="csrf-token"]').attributes.content.value fetch("#{url}.json", method: "POST" mode: "cors" cache: "no-cache" credentials: "same-origin" headers: "Content-Type": "application/json" "X-CSRF-Token": token redirect: "follow" referrer: "no-referrer" ).then (response) -> response.json()