Hi @SyedFarhan why are you returning twice?!
Actually, you should just return with the promise and reject with response error and resolve with (parsed) response body?!
export const getAllProjects( userAccountId, httpClient ) => {
return new Promise( ( resolve, reject ) => {
httpClient
.asUserbyAccountID(userAccountId)
.get( "<url>", ( err, response, body ) => {
if( err ) reject(err);
resolve( JSON.parse(body) )
)}
})
};
This will resolve with the response body.
Best Valentin
FYI: I provided a more detailed solution here: How to get return value from httpClient - Jira Development / Jira Cloud - The Atlassian Developer Community