Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = app || {};
- app.controller = function(){
- this.name = m.prop('');
- this.password = m.prop('');
- this.login = function(name, password){
- m.request({
- method:"POST",
- url:"//97.74.4.61:4500/login",
- data:{
- user:name,
- password:password
- }
- }).then(function(response){
- console.log(response.token);
- })
- }
- }
- var app = app || {};
- app.view = function(ctrl){
- return m('div.container', [
- m('h4', 'Login'),
- m('form',{onsubmit:ctrl.login}, [
- m('lable', 'Username '),
- m('input[type=text]', {value:ctrl.name(), oninput:m.withAttr('value', ctrl.name)}),
- m('br'), m('br'),
- m('label', 'Password '),
- m('input[type=password]', {value:ctrl.password(), oninput:m.withAttr('value', ctrl.password)}),
- m('br'), m('br'),
- m('button','Login')
- ])
- ])
- }
- app.User = function(){
- //data = data || {}
- this.name = m.prop('');
- this.password = m.prop('');
- //this.login = function(user, password){
- // return m.request({
- // method:'POST',
- // url:'//97.74.4.61:4500/login',
- // data:{user:user, password:password}
- // })
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement