Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

TypeError: JSON.stringify(...).then is not a function

fetch('http://localhost:5000/', {
    method : 'post',
    headers :{ 'Content-Type' : 'application/json'},
    body : JSON.stringify({
         userId : this.state.userId,
         password : this.state.password
   })
}).then(response => response.json())
  .then(data => {
    if(data === 'success'){
            this.props.onRouteChange('home');
    }
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to create thumbnail image from video in javascript 
Javascript :: what is the function of delete operator in javascript 
Javascript :: react tabs 
Javascript :: isprime js 
Javascript :: usememo hook react 
Javascript :: use this inside a foreach 
Javascript :: select selectedindex jquery 
Javascript :: javascript new line 
Javascript :: test if value is function 
Javascript :: add mute button to html5 video player 
Javascript :: save console log to file nodejs 
Javascript :: execute command javascript 
Javascript :: express referrer 
Javascript :: js sum 
Javascript :: google gapi auth2 get current token 
Javascript :: redirect to website from promise value fetch 
Javascript :: storage package npm react 
Javascript :: javascript loop through array backwards 
Javascript :: js .touppercase 
Javascript :: get parameter from url reactjs 
Javascript :: jquery ui timepicker 
Javascript :: chrome storage set example 
Javascript :: text input placeholder font family react native 
Javascript :: javascript if not 
Javascript :: Cannot use import statement inside the Node.js REPL, alternatively use dynamic import 
Javascript :: moment format yyyy-mm-dd 
Javascript :: javascript non-repeating randomize array 
Javascript :: es6 functions 
Javascript :: window resize done 
Javascript :: react native showing double header stack and drawer menu 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =