diff --git a/app/api/leantime/tasks/route.ts b/app/api/leantime/tasks/route.ts index eff2e612..23c425bc 100644 --- a/app/api/leantime/tasks/route.ts +++ b/app/api/leantime/tasks/route.ts @@ -24,12 +24,14 @@ async function getLeantimeUserId(email: string): Promise { console.log('API URL:', process.env.LEANTIME_API_URL); console.log('Token length:', process.env.LEANTIME_TOKEN.length); + const headers: Record = { + '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 = { + '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',