SHARE
TWEET

Untitled

a guest Jul 20th, 2017 117 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Vue from 'vue'
  2. import Request from 'superagent'
  3.  
  4. require('./css/style.css')
  5.  
  6. new Vue({
  7.     el: '#app',
  8.     data: {
  9.         username: '',
  10.         password: ''
  11.     },
  12.     methods: {
  13.         login() {
  14.             if (this.username === '' || this.password === '') {
  15.                 return false
  16.             }
  17.  
  18.             var login = {
  19.                 username: this.username,
  20.                 password: this.password
  21.             }
  22.  
  23.             console.log(login)
  24.  
  25.             Request
  26.                 .put('http://localhost:8181/login')
  27.                 .send(JSON.stringify(login))
  28.                 .end(function(err, res) {
  29.                 if (err || !res.ok) {
  30.                     console.log(err)
  31.                     console.log("error!")
  32.                 } else {
  33.                     console.log(res.text)
  34.                 }
  35.             })
  36.         },
  37.     }
  38. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top