add user leantime api 2
This commit is contained in:
parent
dc0021dc91
commit
bd12734bb8
@ -212,7 +212,7 @@ async function createLeantimeUser(userData: {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${process.env.LEANTIME_TOKEN}`,
|
'X-API-Key': process.env.LEANTIME_TOKEN || '',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
method: 'leantime.rpc.Users.Users.addUser',
|
method: 'leantime.rpc.Users.Users.addUser',
|
||||||
@ -232,12 +232,13 @@ async function createLeantimeUser(userData: {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
console.log('Leantime response:', data);
|
||||||
|
|
||||||
if (!response.ok || !data.result) {
|
if (!response.ok || !data.result) {
|
||||||
console.error('Leantime user creation failed:', data);
|
console.error('Leantime user creation failed:', data);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: 'Failed to create user in Leantime'
|
error: data.error?.message || 'Failed to create user in Leantime'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user