Skip to content

Instantly share code, notes, and snippets.

@yushanwebdev
Last active September 28, 2021 05:15

Revisions

  1. yushanwebdev revised this gist Sep 28, 2021. No changes.
  2. yushanwebdev revised this gist Sep 28, 2021. 2 changed files with 0 additions and 0 deletions.
    Empty file removed gistfile1.txt
    Empty file.
  3. yushanwebdev revised this gist Sep 26, 2021. 3 changed files with 3 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions JavaScript Fetch API post data not added to the Request body
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    This GitHub issue helped me to solved this.
    https://github.com/matthew-andrews/isomorphic-fetch/issues/34
    3 changes: 3 additions & 0 deletions solution.js → ...ost data not added to the Request body.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    // https://github.com/matthew-andrews/isomorphic-fetch/issues/34
    // This helped me to solve the issue.

    const myHeaders = new Headers();

    myHeaders.append('Content-Type', 'application/json');
    Empty file added gistfile1.txt
    Empty file.
  4. yushanwebdev revised this gist Sep 26, 2021. 2 changed files with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions solution.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    const myHeaders = new Headers();

    myHeaders.append('Content-Type', 'application/json');

    fetch('/contact-form', {
    method: 'POST',
    headers: myHeader,
    body: JSON.stringify(fields)
    }).then(() => {
    dispatch(contactFormSubmitSuccess());
    });
  5. yushanwebdev renamed this gist Sep 26, 2021. 1 changed file with 0 additions and 0 deletions.
  6. yushanwebdev renamed this gist Sep 26, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. yushanwebdev created this gist Sep 26, 2021.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    This GitHub issue helped me to solved this.
    https://github.com/matthew-andrews/isomorphic-fetch/issues/34