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

41 lines
685 B
JavaScript
Raw Normal View History

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;
}
}
};