PHP Classes

File: resources/assets/js/views/Register.vue

Recommend this page to a friend!
  Classes of Hillary Kollan  >  Laravel eCommerce with Vue.js  >  resources/assets/js/views/Register.vue  >  Download  
File: resources/assets/js/views/Register.vue
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Laravel eCommerce with Vue.js
Implementation of an interactive eCommerce site
Author: By
Last change:
Date: 10 months ago
Size: 4,326 bytes


Class file image Download
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card card-default">
                    <div class="card-header">Register</div>
                    <div class="card-body">
                            <div class="form-group row">
                                <label for="name" class="col-md-4 col-form-label text-md-right">Name</label>
                                <div class="col-md-6">
                                    <input id="name" type="text" class="form-control" v-model="name" required autofocus>
                            <div class="form-group row">
                                <label for="email" class="col-md-4 col-form-label text-md-right">E-Mail Address</label>
                                <div class="col-md-6">
                                    <input id="email" type="email" class="form-control" v-model="email" required>
                            <div class="form-group row">
                                <label for="password" class="col-md-4 col-form-label text-md-right">Password</label>
                                <div class="col-md-6">
                                    <input id="password" type="password" class="form-control" v-model="password" required>
                            <div class="form-group row">
                                <label for="password-confirm" class="col-md-4 col-form-label text-md-right">Confirm Password</label>
                                <div class="col-md-6">
                                    <input id="password-confirm" type="password" class="form-control" v-model="password_confirmation" required>
                            <div class="form-group row mb-0">
                                <div class="col-md-6 offset-md-4">
                                    <button type="submit" class="btn btn-primary" @click="handleSubmit">
    export default {
        props : ['nextUrl'],
            return {
                name : "",
                email : "",
                password : "",
                password_confirmation : ""
        methods : {
            handleSubmit(e) {
                if (this.password !== this.password_confirmation || this.password.length <= 0) {
                    this.password = ""
                    this.password_confirmation = ""
                    return alert('Passwords do not match')

                data = {
                     "password": this.password,
                     "c_password": this.password_confirmation
               let headers = {
                    "Content-Type": "application/json",
                fetch('api/register', {
                    body: JSON.stringify(data),
                    headers: headers
                }).then(response => response.json()).then(response => {
                    let data = response;
                    localStorage.setItem('sellify.user', JSON.stringify(data.user))
                    localStorage.setItem('sellify.jwt', data.token)
                    if (localStorage.getItem('sellify.jwt') != null) {
                        let nextUrl = this.$route.params.nextUrl;
                        this.$router.push((nextUrl != null ? nextUrl : '/'))
For more information send a message to info at phpclasses dot org.