Guest User

Untitled

a guest
Oct 22nd, 2020
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. <template>
  2. <v-row justify="center">
  3. <v-col cols="12" sm="12" md="6" lg="4" xl="2">
  4. <v-card shaped elevation="5" rounded>
  5. <v-toolbar class="rounded-t" color="indigo darken-2" tile dark>
  6. <v-toolbar-title>Logowanie</v-toolbar-title>
  7. </v-toolbar>
  8. <v-container class="py-10 px-10 text-center">
  9. <ValidationObserver
  10. ref="obs"
  11. v-slot="{ invalid, handleSubmit }"
  12. >
  13. <v-form @submit.prevent="handleSubmit(onSubmit)">
  14. <ValidationProvider
  15. name="Login"
  16. rules="required"
  17. v-slot="{ errors }"
  18. >
  19. <v-text-field
  20. v-model="username"
  21. :error-messages="errors"
  22. label="Login"
  23. color="indigo"
  24. outlined
  25. dense
  26. required
  27. />
  28. </ValidationProvider>
  29. <ValidationProvider
  30. name="Haslo"
  31. rules="required"
  32. v-slot="{ errors }"
  33. >
  34. <v-text-field
  35. v-model="password"
  36. :error-messages="errors"
  37. type="password"
  38. label="Hasło"
  39. color="indigo"
  40. outlined
  41. dense
  42. required
  43. />
  44. </ValidationProvider>
  45. <v-btn
  46. class="mt-15"
  47. color="indigo darken-2"
  48. dark
  49. :disabled="invalid"
  50. >
  51. <font-awesome-icon icon="unlock" class="mr-2" />
  52. Zaloguj
  53. </v-btn>
  54. </v-form>
  55. </ValidationObserver>
  56. </v-container>
  57. </v-card>
  58. </v-col>
  59. </v-row>
  60. </template>
  61.  
  62. <script>
  63. import {
  64. ValidationObserver,
  65. ValidationProvider,
  66. setInteractionMode,
  67. } from 'vee-validate'
  68.  
  69. setInteractionMode('edger')
  70.  
  71. export default {
  72. name: 'LoginPage',
  73.  
  74. components: { ValidationProvider, ValidationObserver },
  75.  
  76. data: () => ({
  77. username: '',
  78. password: '',
  79. loading: '',
  80. }),
  81.  
  82. methods: {
  83. onSubmit() {
  84. this.loading = true
  85. let username = this.username
  86. let password = this.password
  87. this.$store
  88. .dispatch('login', { username, password })
  89. .then(() => this.$router.push('/'))
  90. .catch(err => console.log(err))
  91. },
  92. },
  93. }
  94. </script>
  95.  
  96. <style scoped></style>
  97.  
Advertisement
Add Comment
Please, Sign In to add comment