круто

This commit is contained in:
aurinex
2025-12-17 13:16:59 +05:00
parent 24423173a6
commit fef89513c2
10 changed files with 555 additions and 105 deletions

View File

@ -35,8 +35,14 @@ export class AuthService {
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`Ошибка авторизации: ${response.status} ${errorText}`);
let detail = '';
try {
const data = await response.json(); // FastAPI: { detail: "..." }
detail = data?.detail || '';
} catch {
detail = await response.text();
}
throw new Error(detail || `HTTP ${response.status}`);
}
const auth = await response.json();