Advertisement
Guest User

Untitled

a guest
Apr 6th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <template>
  2. <div class="auth">
  3. <h2>Sign In</h2>
  4. <form @submit.prevent="signIn">
  5. <q-input square filled color="teal" label="Username" v-model="form.username"/>
  6. <q-input square filled color="teal" label="Password" type="password" v-model="form.password"/>
  7. <div class="row">
  8. <q-btn type="submit" @click="signIn" label="Sign In" class="authButton">
  9. <template v-slot:loading>
  10. <q-spinner-facebook/>
  11. </template>
  12. </q-btn>
  13. </div>
  14. </form>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'SignIn',
  20. data () {
  21. return {
  22. form: {
  23. username: '',
  24. password: ''
  25. }
  26. }
  27. },
  28. methods: {
  29. async signIn () {
  30. const { username, password } = this.form
  31. await this.$Auth.signIn(username, password)
  32. this.$AmplifyEventBus.$emit('authState', 'signedIn')
  33. parent.signedIn = true
  34. this.$router.push({ name: 'todo' })
  35. }
  36. }
  37. }
  38. </script>
  39. <style>
  40. .authButton {
  41. width: 100%;
  42. padding: 10px;
  43. margin-top: 10px;
  44. background-color: #2196f3;
  45. border: none;
  46. color: white;
  47. outline: none;
  48. }
  49. .auth {
  50. margin: 0 auto;
  51. width: 460px;
  52. }
  53. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement