Minor fixes.

This commit is contained in:
fanmuchen 2025-05-19 10:17:17 +08:00
parent 418a30f062
commit 18033667d3
3 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,9 @@ export default function HealthStatus() {
const checkHealth = async () => {
try {
setLoading(true);
const response = await fetch(`${process.env.BACKEND_URL}/health`);
const response = await fetch(`${process.env.BACKEND_URL}/health`, {
credentials: "include",
});
if (!response.ok) {
throw new Error(`Server responded with status: ${response.status}`);
@ -19,7 +21,7 @@ export default function HealthStatus() {
let data;
try {
data = await response.json();
} catch (jsonErr) {
} catch {
setError("Response is not valid JSON");
setHealth({});
return;

View File

@ -46,7 +46,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
let userData;
try {
userData = await response.json();
} catch (jsonErr) {
} catch {
// 不是 JSON降级处理
setUser(null);
setIsAuthenticated(false);