круто
This commit is contained in:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user