Widget Devoir Finition
This commit is contained in:
parent
957e70a160
commit
580799f9ee
@ -86,11 +86,14 @@ async function getLeantimeUserId(email: string): Promise<number | null> {
|
||||
}
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
console.log('[LEANTIME_TASKS] 🔵 API CALLED - Starting request');
|
||||
try {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.email) {
|
||||
console.log('[LEANTIME_TASKS] ❌ Unauthorized - no session');
|
||||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
console.log('[LEANTIME_TASKS] ✅ Session found, user:', session.user.email);
|
||||
|
||||
// Check for force refresh parameter
|
||||
const url = new URL(request.url);
|
||||
@ -185,14 +188,11 @@ export async function GET(request: NextRequest) {
|
||||
throw new Error('Invalid response format from Leantime');
|
||||
}
|
||||
|
||||
console.log('[LEANTIME_TASKS] 🔍 RAW DATA FROM LEANTIME - Total tasks:', data.result.length);
|
||||
// Log RAW data from Leantime to see exact status values (using console.log so it shows in production)
|
||||
console.log('[LEANTIME_TASKS] 🔍 RAW DATA FROM LEANTIME API:', JSON.stringify(data.result.map((task: any) => ({
|
||||
id: task.id,
|
||||
headline: task.headline,
|
||||
status: task.status,
|
||||
statusType: typeof task.status,
|
||||
editorId: task.editorId,
|
||||
})), null, 2));
|
||||
data.result.forEach((task: any) => {
|
||||
console.log(`[LEANTIME_TASKS] Task ID: ${task.id}, Headline: ${task.headline}, Status: ${task.status} (type: ${typeof task.status}), EditorId: ${task.editorId}`);
|
||||
});
|
||||
|
||||
// Log detailed status information before filtering
|
||||
const statusBreakdownBefore = data.result.reduce((acc: any, task: any) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user