| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <script sepup>
- import { ref } from 'vue';
- const login = ref(''), password = ref('');
- let errorForm = ref('');
- if(login.value && password.value){
- try {
- const submitForm = async () => {
- const {data} = await $fetch('/api/signIn', {
- method: 'post',
- body: {
- login: login.value,
- password: password.value
- }
- })
- }
- } catch (error) {
- console.log('signIn', error);
-
- }
- }else{
- errorForm.value = 'Заполните поля'
- }
- </script>
- <template>
- <section class="d-flex justify-content-center align-items-center flex-column">
- <form @submit.prevent="submitForm()" class="d-flex flex-column gap-3">
- <h1>авторизация</h1>
- <input type="text" placeholder="Логин" v-model="login">
- <input type="password" placeholder="Пароль" v-model="password">
- <button type="submit" class="btn btn-primary">Авторизироватся</button>
- </form>
- </section>
- </template>
- <style scoped>
- form{
- width: 450px;
- }
- </style>
|