working leantime widget 3
This commit is contained in:
parent
3b8520da1f
commit
c00963a533
@ -18,6 +18,8 @@ export async function GET() {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-API-Key': process.env.LEANTIME_TOKEN || '',
|
'X-API-Key': process.env.LEANTIME_TOKEN || '',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Authorization': `Bearer ${session.accessToken}`,
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
method: 'leantime.rpc.Tickets.Tickets.getAllStatusLabelsByUserId',
|
method: 'leantime.rpc.Tickets.Tickets.getAllStatusLabelsByUserId',
|
||||||
@ -30,9 +32,17 @@ export async function GET() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const responseText = await response.text();
|
const responseText = await response.text();
|
||||||
console.log('Leantime API Response:', responseText);
|
console.log('Leantime API Response Status:', response.status);
|
||||||
|
console.log('Leantime API Response Headers:', response.headers);
|
||||||
|
console.log('Leantime API Response Body:', responseText);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
if (response.status === 401) {
|
||||||
|
return NextResponse.json({ error: "Unauthorized access to Leantime API" }, { status: 401 });
|
||||||
|
}
|
||||||
|
if (response.status === 403) {
|
||||||
|
return NextResponse.json({ error: "Forbidden access to Leantime API" }, { status: 403 });
|
||||||
|
}
|
||||||
throw new Error(`Leantime API returned ${response.status}: ${responseText}`);
|
throw new Error(`Leantime API returned ${response.status}: ${responseText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user