generated from VLADIMIR/template_frontend
clear
This commit is contained in:
@@ -1,3 +1,56 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { NCard, NTabs, NTabPane, NCheckbox, NButton, NSpace, NInput, NAutoComplete, useMessage } from 'naive-ui'
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const username = ref('')
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
const approval = ref(false)
|
||||
|
||||
|
||||
const options = computed(() => {
|
||||
return ['@mail.ru', '@yandex.ru', '@gmail.com'].map((suffix) => {
|
||||
const prefix = email.value.split('@')[0]
|
||||
return {
|
||||
label: prefix + suffix,
|
||||
value: prefix + suffix
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
async function signin() {
|
||||
const res = await authStore.login(email.value, password.value)
|
||||
|
||||
if (!res && authStore.error != null) {
|
||||
message.error(authStore.error)
|
||||
return
|
||||
}
|
||||
|
||||
router.push('/office')
|
||||
}
|
||||
|
||||
async function signup() {
|
||||
if (!approval.value) {
|
||||
return
|
||||
}
|
||||
const res = await authStore.signup(username.value, email.value)
|
||||
if (!res && authStore.error != null) {
|
||||
message.error(authStore.error)
|
||||
return
|
||||
}
|
||||
message.info("Пароль отправлен на почту")
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-card style="margin-bottom: 16px" class="sign-card">
|
||||
<n-tabs type="line" animated>
|
||||
@@ -60,59 +113,6 @@
|
||||
</n-card>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { NCard, NTabs, NTabPane, NCheckbox, NButton, NSpace, NInput, NAutoComplete, useMessage } from 'naive-ui'
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const username = ref('')
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
const approval = ref(false)
|
||||
|
||||
|
||||
const options = computed(() => {
|
||||
return ['@mail.ru', '@yandex.ru', '@gmail.com'].map((suffix) => {
|
||||
const prefix = email.value.split('@')[0]
|
||||
return {
|
||||
label: prefix + suffix,
|
||||
value: prefix + suffix
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
async function signin() {
|
||||
const res = await authStore.login(email.value, password.value)
|
||||
|
||||
if (!res && authStore.error != null) {
|
||||
message.error(authStore.error)
|
||||
return
|
||||
}
|
||||
|
||||
router.push('/office')
|
||||
}
|
||||
|
||||
async function signup() {
|
||||
if (!approval.value) {
|
||||
return
|
||||
}
|
||||
const res = await authStore.signup(username.value, email.value)
|
||||
if (!res && authStore.error != null) {
|
||||
message.error(authStore.error)
|
||||
return
|
||||
}
|
||||
message.info("Пароль отправлен на почту")
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sign-card {
|
||||
background-color: rgb(29, 29, 29);
|
||||
|
||||
Reference in New Issue
Block a user