public/js/login.js
// loginUser does a post to our "api/login" route and if successful, redirects us the the members page

loginUser does a post to our "api/login" route and if successful, redirects us the the members page
loginUser does a post to our " api / login " route and if successful redirects us the the members page
function loginUser(email, password) {
        $.post("/api/login", {
                email: email,
                password: password
            })
            .then(data => {
                console.log(data);
                localStorage.setItem("user", JSON.stringify(data));
                window.location.replace("/members");
            })
            .catch(err => {
            Swal.fire 
            ({
                title: 'Oops',
                text:'Please check your email AND password',
                icon: 'error', 
                backdrop: `
                rgba(0,0,123,0.4)
                url("/images/nyan-cat2.gif")
                right top
                no-repeat
              `
            })
                console.log(err);
            });
    }
function loginUser ( email , password ) { $ . post ( "/api/login" , { email : email , password : password } ) . then ( data => { console . log ( data ) ; localStorage . setItem ( "user" , JSON . stringify ( data ) ) ; window . location . replace ( "/members" ) ; } ) . catch ( err => { Swal . fire ( { title : 'Oops' , text : 'Please check your email AND password' , icon : 'error' , backdrop : ` ` } ) console . log ( err ) ; } ) ; }
loginUser does a post to our "api/login" route and if successful, redirects us the the members page
loginUser does a post to our " api / login " route and if successful redirects us the the members page
// If there's an error, log the error
