Skip to content

Instantly share code, notes, and snippets.

@jordanhudgens
Created June 10, 2018 01:23
Show Gist options
  • Save jordanhudgens/a24b6ad62dc8d24b42b09e7e7a6ddda0 to your computer and use it in GitHub Desktop.
Save jordanhudgens/a24b6ad62dc8d24b42b09e7e7a6ddda0 to your computer and use it in GitHub Desktop.
<template>
<div>
<h2>Register</h2>
<form @submit.prevent="submitRegistration">
<div>
<input type="text" v-model="email">
</div>
<div>
<input type="password" v-model="password">
</div>
<div>
<input type="password" v-model="password_confirmation">
</div>
<button type="submit">Register</button>
</form>
</div>
</template>
<script>
import axios from 'axios';
export default {
name: 'Registration',
data() {
return {
email: null,
password: null,
password_confirmation: null
}
},
methods: {
submitRegistration() {
axios
.post("your-url-registration-endpoint-url",
{
user: {
email: this.email,
password: this.password,
password_confirmation: this.password_confirmation
}
})
.then(response => {
console.log('created successfully', response.data);
return response.data;
})
.catch(error => {
console.log(error);
})
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment