This commit is contained in:
@@ -41,7 +41,7 @@ apiClient.interceptors.request.use(
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("Failed to retrieve auth token:", error);
|
||||
// Auth token retrieval failed - request will proceed without token
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ apiClient.interceptors.response.use(
|
||||
|
||||
// กรณี Token หมดอายุ หรือ ไม่มีสิทธิ์
|
||||
if (status === 401) {
|
||||
console.error("Unauthorized: Please login again.");
|
||||
// Unauthorized: redirect handled by auth interceptor
|
||||
// สามารถเพิ่ม Logic Redirect ไปหน้า Login ได้ถ้าต้องการ
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,6 @@ export const numberingApi = {
|
||||
): Promise<{ number: string }> => {
|
||||
// Fallback mock for legacy UI - requires proper context for real use
|
||||
const mockNumber = `TEST-${new Date().getFullYear()}-${String(Math.floor(Math.random() * 9999)).padStart(4, '0')}`;
|
||||
console.log('Using mock generateTestNumber. Context:', context);
|
||||
return { number: mockNumber };
|
||||
},
|
||||
};
|
||||
|
||||
@@ -47,7 +47,7 @@ async function refreshAccessToken(token: JWT) {
|
||||
refreshToken: data.refresh_token ?? token.refreshToken,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log("RefreshAccessTokenError", error);
|
||||
// RefreshAccessTokenError - token will be invalidated
|
||||
|
||||
return {
|
||||
...token,
|
||||
@@ -73,7 +73,6 @@ export const {
|
||||
try {
|
||||
const { username, password } = await loginSchema.parseAsync(credentials);
|
||||
|
||||
console.log(`Attempting login to: ${baseUrl}/auth/login`);
|
||||
|
||||
const res = await fetch(`${baseUrl}/auth/login`, {
|
||||
method: "POST",
|
||||
@@ -83,7 +82,6 @@ export const {
|
||||
|
||||
if (!res.ok) {
|
||||
const errorMsg = await res.text();
|
||||
console.error("Login failed:", errorMsg);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -91,7 +89,6 @@ export const {
|
||||
const backendData = responseJson.data || responseJson;
|
||||
|
||||
if (!backendData || !backendData.access_token) {
|
||||
console.error("No access token received");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -107,7 +104,6 @@ export const {
|
||||
} as User;
|
||||
|
||||
} catch (error) {
|
||||
console.error("Auth error:", error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -14,10 +14,8 @@ export const dashboardService = {
|
||||
if (Array.isArray(response.data)) {
|
||||
return response.data;
|
||||
}
|
||||
console.warn('Dashboard activity: expected array, got:', typeof response.data);
|
||||
return [];
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch recent activity:', error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
@@ -32,10 +30,8 @@ export const dashboardService = {
|
||||
if (Array.isArray(response.data)) {
|
||||
return response.data;
|
||||
}
|
||||
console.warn('Dashboard pending: unexpected format:', typeof response.data);
|
||||
return [];
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch pending tasks:', error);
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user