1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

фикс авторизации

This commit is contained in:
MoonTestUse1
2025-01-03 20:34:37 +06:00
parent 3ca0f9b247
commit 921cc4421f
4 changed files with 24 additions and 20 deletions

View File

@@ -18,12 +18,13 @@ export const useAuthStore = defineStore('auth', () => {
async function login(lastName: string, password: string): Promise<boolean> {
try {
const formData = new FormData();
formData.append('username', lastName);
formData.append('password', password);
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ lastName, password }),
body: formData
});
if (!response.ok) {
@@ -41,12 +42,13 @@ export const useAuthStore = defineStore('auth', () => {
async function adminLogin(username: string, password: string): Promise<boolean> {
try {
const response = await fetch('/api/auth/admin', {
const formData = new FormData();
formData.append('username', username);
formData.append('password', password);
const response = await fetch('/api/auth/admin/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ username, password }),
body: formData
});
if (!response.ok) {