Guest User

Untitled

a guest
Apr 5th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. {
  2. path: '/',
  3. component: () => import('components/login'),
  4. },
  5.  
  6. {
  7. path: '/main',
  8. component: () => import('layouts/default'),
  9. children: [
  10. { path: '', component: () => import('pages/index') },
  11. { path: 'chat', component: () => import('components/chat')}
  12. ]
  13. },
  14.  
  15. { // Always leave this as last one
  16. path: '*',
  17. component: () => import('pages/404')
  18. }
  19. ]
  20.  
  21. <template>
  22. <div>
  23. <form id="login" label="Login">
  24. <q-input type="text" float-label="Username" v-model="username" /> <br>
  25. <q-input v-model="password" type="password" float-label="Password" />
  26. <q-btn input type="submit" @click="authenticate()">Submit</q-btn>
  27. </form>
  28. </div>
  29. </template>
  30.  
  31. <style>
  32. input{
  33. margin: 10px;
  34. }
  35. #login{
  36. vertical-align: middle;
  37. text-align: center;
  38. }
  39. </style>
  40.  
  41. <script>
  42.  
  43. module.exports = {
  44. data() {
  45. return {
  46. username: '',
  47. password: ''
  48. }
  49. },
  50. methods: {
  51. authenticate () {
  52. this.$axios.post('/api/login', {
  53. Username: this.username,
  54. Password: this.password
  55. })
  56. .then(response => {
  57. this.$Socket.emit('LoginInfo', {
  58. firstname: response.data[0].ClientFirstName,
  59. lastname: response.data[0].ClientLastName,
  60. name: response.data[0].ClientFirstName + ' ' + response.data[0].ClientLastName,
  61. userid: response.data[0].ClientID
  62. })
  63. console.log(this.$router)
  64. this.$router.push({path: '/main'})
  65. })
  66. .catch(function (error) {
  67. console.log(error)
  68. })
  69. }
  70. }
  71. }
  72. </script>
Add Comment
Please, Sign In to add comment