function postDataAuthentication(functionSuccess, functionError, url, credentials){
  const options = {
    method: "POST",
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
      'X-CSRFToken': getCookie('csrftoken')
    },
    body: JSON.stringify(credentials)
  }
  const checkBox = credentials.checkbox
  fetch(url, options)
      .then(resp=> {
        if(resp.status >= 200 && resp.status < 300){
          resp.json().then(json=> functionSuccess(json, checkBox))
        }else{
          resp.json().then(json=> functionError(json))
        }
      })

}
// Function to post data to login and register endpoints
Function to post data to login and register endpoints
Function to post data to login and register endpoints
function postDataAuthentication(functionSuccess, functionError, url, credentials){
  const options = {
    method: "POST",
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
      'X-CSRFToken': getCookie('csrftoken')
    },
    body: JSON.stringify(credentials)
  }
  const checkBox = credentials.checkbox
  fetch(url, options)
      .then(resp=> {
        if(resp.status >= 200 && resp.status < 300){
          resp.json().then(json=> functionSuccess(json, checkBox))
        }else{
          resp.json().then(json=> functionError(json))
        }
      })
}
function postDataAuthentication ( functionSuccess , functionError , url , credentials ) { const options = { method : "POST" , headers : { 'Accept' : 'application/json' , 'Content-Type' : 'application/json' , 'X-CSRFToken' : getCookie ( 'csrftoken' ) } , body : JSON . stringify ( credentials ) } const checkBox = credentials . checkbox fetch ( url , options ) . then ( resp => { if ( resp . status >= 200 && resp . status < 300 ) { resp . json ( ) . then ( json => functionSuccess ( json , checkBox ) ) } else { resp . json ( ) . then ( json => functionError ( json ) ) } } ) }
Function to post data to login and register endpoints
Function to post data to login and register endpoints