Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  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. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement