mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
чиним билд06
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.1.4",
|
||||
"vue-tsc": "^2.0.6",
|
||||
"@tailwindcss/forms": "^0.5.7"
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@types/axios": "^0.14.0"
|
||||
}
|
||||
}
|
15
frontend/src/env.d.ts
vendored
Normal file
15
frontend/src/env.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
}
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
@@ -56,7 +56,13 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import axios from 'axios'
|
||||
import axios, { AxiosError } from 'axios'
|
||||
|
||||
interface LoginResponse {
|
||||
access_token: string
|
||||
token_type: string
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
const lastName = ref('')
|
||||
@@ -70,7 +76,7 @@ const handleLogin = async () => {
|
||||
|
||||
try {
|
||||
console.log('Отправка запроса на авторизацию...')
|
||||
const response = await axios.post('/api/auth/login', {
|
||||
const response = await axios.post<LoginResponse>('/api/auth/login', {
|
||||
last_name: lastName.value,
|
||||
password: password.value
|
||||
})
|
||||
@@ -83,9 +89,10 @@ const handleLogin = async () => {
|
||||
console.log('Перенаправление на /requests...')
|
||||
// Перенаправляем на страницу заявок
|
||||
await router.push('/requests')
|
||||
} catch (e: any) {
|
||||
} catch (e) {
|
||||
console.error('Ошибка при авторизации:', e)
|
||||
error.value = e.response?.data?.detail || 'Неверная фамилия или пароль'
|
||||
const axiosError = e as AxiosError<{ detail: string }>
|
||||
error.value = axiosError.response?.data?.detail || 'Неверная фамилия или пароль'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
@@ -16,16 +16,27 @@
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
/* Paths */
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
}
|
||||
},
|
||||
|
||||
/* Additional Options */
|
||||
"allowJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"vite.config.ts"
|
||||
],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
@@ -4,7 +4,8 @@
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
Reference in New Issue
Block a user