1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-10-31 10:36:53 +00:00
not-gwent-online/site/client/app/modules/session/components/register.js
2015-06-23 16:24:49 +02:00

41 lines
685 B
JavaScript

module.exports = {
template: require('./../views/register.html'),
inherit: true,
data: function() {
return {
username: '',
password: '',
email: ''
}
},
methods: {
register: function(e) {
e.preventDefault();
if( ! this.username || ! this.password || ! this.email) {
$('.form-error').hide().fadeIn('fast');
return false;
}
$('.form-error').hide();
$('.icon-action-load').show();
this.$http.post('./api/register', this.$data, function(data) {
location.reload();
}).error(function (data) {
$('.icon-action-load').hide();
})
return false;
}
}
};