Shopify Customer login form with Vue /Ajax

SenkuBhai
New Member
2 0 0

 

Please help me 

[Please pardon me for my bad English]

I am trying to login as customer with vue and without page reload or redirect. 

When I submit form I got 200 and 302 response. but can't login. 

I have included my code here :

 

 

let productForm = new Vue({
    el:".vue-login-form",
    data(){
        return{
            form: {
                email: null,
                password: null,
            },
            customerData: null,
        }
    },

    methods:{
        login(){
            axios.post('/account/login', this.form )
            .then((response) => {
                console.log(response);
                this.customerData = response.data;
            })
            .catch(function (error){
            });

            },
        },
        
})
<form action="">
        <div class="form-top">
          <h2>Welcome Back!</h2>
          <p>Please login to your account.</p>
        </div>
        <div class="login-fields">
          <div class="input">
            <input type="email" v-model="form.email" placeholder="Email address">
          </div>
          <div class="input mb-0">
            <input type="password" v-model="form.password" placeholder="Password">
          </div>
          <div class="forgot-pass"><a href="#" type="button" id="ppassword" @Click="showForgot">Forgot Password?</a></div>
          <div class="submit-button">
            <button type="button" @Click="login()">Log In</button>
          </div>
        </div>
      </form>

 

0 Likes