Guest User

Untitled

a guest
Oct 31st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <script>
  2. export default {
  3. data(){
  4. return {
  5. form :{
  6. email:null,
  7. password:null
  8. }
  9. }
  10. },
  11. methods:{
  12. login(){
  13. User.login(this.form)
  14. }
  15. }
  16. }
  17. </script>
  18.  
  19. class User {
  20. login(data){
  21. axios.post('/api/auth/login',data)
  22. .then(res => this.responseAfterLogin(res))
  23. .catch(error => console.log(error.response.data))
  24. }
  25. }
  26. export default User = new User();
  27.  
  28. <script>
  29. export default {
  30. data(){
  31. return {
  32. form :{
  33. email:null,
  34. password:null
  35. }
  36. }
  37. },
  38. methods:{
  39. login(){
  40. axios.post('/api/auth/login',this.form)
  41. .then(res => console.log(res.data))
  42. .catch(error => console.log(error.response.data))
  43. }
  44. }
  45. }
  46. </script>
Add Comment
Please, Sign In to add comment