2015-06-23 12:32:26 +00:00
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
template: require('./../views/register.html'),
|
|
|
|
|
|
|
|
inherit: true,
|
|
|
|
|
2015-06-23 13:10:01 +00:00
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
username: '',
|
|
|
|
password: '',
|
|
|
|
email: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-06-23 12:32:26 +00:00
|
|
|
methods: {
|
|
|
|
register: function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
2015-06-23 13:10:01 +00:00
|
|
|
if( ! this.username || ! this.password || ! this.email) {
|
|
|
|
$('.form-error').hide().fadeIn('fast');
|
2015-06-23 14:24:49 +00:00
|
|
|
|
|
|
|
return false;
|
2015-06-23 13:10:01 +00:00
|
|
|
}
|
2015-06-23 12:32:26 +00:00
|
|
|
|
2015-06-23 14:24:49 +00:00
|
|
|
$('.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();
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2015-06-23 12:32:26 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|