public/js/music_playlist.js
/**
 * Handle user authorization login form submit button.
 */
Handle user authorization login form submit button.
Handle user authorization login form submit button .
function sendAuthUserLoginForm() {
    var email = document.getElementById('formAuthUserLoginEmail');
    var emailValue = email.value;
    var password = document.getElementById('formAuthUserLoginPassword');
    var passwordValue = password.value;
    var status = document.getElementById('formAuthUserLoginStatus');
    if (emailValue == '' || passwordValue == '') {
        status.innerText = 'Fill in all fields!'
        return;
    }
    var url = base_url + "/api/auth/login";
    var data = {'email': emailValue, 'password': passwordValue};
    fetch(url, {
        credentials: "same-origin",
        method: 'POST',
        body: JSON.stringify(data),
        headers:{
            'Content-Type': 'application/json',
            'X-Requested-With': 'XMLHttpRequest',
            'X-CSRF-TOKEN': getCSRFToken()
        }
    })
    .then(function(response) {
        return response.json();
    })
    .then(function(json) {
        status.innerText = JSON.stringify(json);
    });     
}
function sendAuthUserLoginForm ( ) { var email = document . getElementById ( 'formAuthUserLoginEmail' ) ; var emailValue = email . value ; var password = document . getElementById ( 'formAuthUserLoginPassword' ) ; var passwordValue = password . value ; var status = document . getElementById ( 'formAuthUserLoginStatus' ) ; if ( emailValue == '' || passwordValue == '' ) { status . innerText = 'Fill in all fields!' return ; } var url = base_url + "/api/auth/login" ; var data = { 'email' : emailValue , 'password' : passwordValue } ; fetch ( url , { credentials : "same-origin" , method : 'POST' , body : JSON . stringify ( data ) , headers : { 'Content-Type' : 'application/json' , 'X-Requested-With' : 'XMLHttpRequest' , 'X-CSRF-TOKEN' : getCSRFToken ( ) } } ) . then ( function ( response ) { return response . json ( ) ; } ) . then ( function ( json ) { status . innerText = JSON . stringify ( json ) ; } ) ; }
Handle user authorization login form submit button.
Handle user authorization login form submit button .