123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <script>
- // import Vue from 'vue'
- import { mapState } from 'pinia'
- // import router from 'vuejs/route'
- import { UserStore } from '@/stores/user'
- export default {
- setup() {
- const userStore = UserStore()
- return { userStore }
- },
- // router,
- // props: ['title', 'block'],
- data () {
- return {
- template: null,
- mail: '',
- passwd: ''
- }
- },
- computed: {
- ...mapState(UserStore,['loginMessage'])
- },
- methods: {
- // ...mapActions({
- // userLogin: 'User/userLogin',
- // openCloseHamMenu: 'Common/openCloseHamMenu'
- // }),
- onSubmitLogin (event) {
- console.log("onSubmitLogin", event, this.mail, this.passwd);
- this.userStore.userLogin({
- mail: this.mail,
- pass: this.passwd
- }).then(() => {
- console.log('LoginBlock user logged-in then')
- })
- // this.userLogin({
- // mail: this.mail,
- // pass: this.password
- // })
- // moved to user.js store
- // .then(() => {
- // console.log('LoginBlock user logged-in')
- // this.openCloseHamMenu(false)
- // this.$router.push({
- // name: 'base'
- // })
- // })
- }
- }
- }
- </script>
- <template>
- <form action="" @submit.prevent="onSubmitLogin">
- <input type="email" placeholder="email" name="email" v-model="mail">
- <input type="password" placeholder="mot de passe" name="passwd" v-model="passwd">
- <input type="submit" value="login">
- <p v-if="loginMessage">{{ loginMessage }}</p>
- </form>
- </template>
- <style lang="css" scoped>
- </style>
|