working leantime widget 50

This commit is contained in:
Alma 2025-04-12 15:16:13 +02:00
parent f6fa3bccaf
commit 7285e45781

View File

@ -24,12 +24,14 @@ async function getLeantimeUserId(email: string): Promise<number | null> {
console.log('API URL:', process.env.LEANTIME_API_URL);
console.log('Token length:', process.env.LEANTIME_TOKEN.length);
const headers: Record<string, string> = {
'Content-Type': 'application/json',
'apiKey': process.env.LEANTIME_TOKEN
};
const response = await fetch(`${process.env.LEANTIME_API_URL}/api/jsonrpc`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.LEANTIME_TOKEN}`
},
headers,
body: JSON.stringify({
jsonrpc: '2.0',
method: 'leantime.rpc.users.getAll',
@ -96,12 +98,14 @@ export async function GET(request: NextRequest) {
}
console.log('Fetching tasks for Leantime user ID:', userId);
const headers: Record<string, string> = {
'Content-Type': 'application/json',
'apiKey': process.env.LEANTIME_TOKEN!
};
const response = await fetch(`${process.env.LEANTIME_API_URL}/api/jsonrpc`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.LEANTIME_TOKEN}`
},
headers,
body: JSON.stringify({
jsonrpc: '2.0',
method: 'leantime.rpc.tickets.getAll',