working leantime widget 134
This commit is contained in:
parent
85a1bbc584
commit
ea2eecc43c
@ -98,7 +98,7 @@ export async function GET(request: NextRequest) {
|
|||||||
const userId = await getLeantimeUserId(session.user.email);
|
const userId = await getLeantimeUserId(session.user.email);
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
console.error('User not found in Leantime:', session.user.email);
|
console.error('User not found in Leantime');
|
||||||
return NextResponse.json({ error: "User not found in Leantime" }, { status: 404 });
|
return NextResponse.json({ error: "User not found in Leantime" }, { status: 404 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,13 +123,12 @@ export async function GET(request: NextRequest) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const responseText = await response.text();
|
const responseText = await response.text();
|
||||||
console.log('Raw tasks response:', responseText);
|
console.log('Tasks API response status:', response.status);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.error('Failed to fetch tasks from Leantime:', {
|
console.error('Failed to fetch tasks from Leantime:', {
|
||||||
status: response.status,
|
status: response.status,
|
||||||
statusText: response.statusText,
|
statusText: response.statusText
|
||||||
headers: Object.fromEntries(response.headers.entries())
|
|
||||||
});
|
});
|
||||||
throw new Error('Failed to fetch tasks from Leantime');
|
throw new Error('Failed to fetch tasks from Leantime');
|
||||||
}
|
}
|
||||||
@ -138,7 +137,7 @@ export async function GET(request: NextRequest) {
|
|||||||
try {
|
try {
|
||||||
data = JSON.parse(responseText);
|
data = JSON.parse(responseText);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to parse tasks response:', e);
|
console.error('Failed to parse tasks response');
|
||||||
throw new Error('Invalid response format from Leantime');
|
throw new Error('Invalid response format from Leantime');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,8 +146,9 @@ export async function GET(request: NextRequest) {
|
|||||||
throw new Error('Invalid response format from Leantime');
|
throw new Error('Invalid response format from Leantime');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the first task to see its complete structure
|
// Log only the number of tasks and their IDs
|
||||||
console.log('Sample task structure:', JSON.stringify(data.result[0], null, 2));
|
console.log('Received tasks count:', data.result.length);
|
||||||
|
console.log('Task IDs:', data.result.map((task: any) => task.id));
|
||||||
|
|
||||||
const tasks = data.result
|
const tasks = data.result
|
||||||
.filter((task: any) => {
|
.filter((task: any) => {
|
||||||
|
|||||||
@ -172,6 +172,7 @@ export async function DELETE(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const userDetails = await userResponse.json();
|
const userDetails = await userResponse.json();
|
||||||
|
console.log('Processing user deletion for ID:', params.userId);
|
||||||
|
|
||||||
// Delete user from Keycloak
|
// Delete user from Keycloak
|
||||||
const deleteResponse = await fetch(
|
const deleteResponse = await fetch(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user