I'm having slight issues with promises in typescript where the results is always pending, even though it's been fulfilled.
I have this function in a utils folder that processes endpoints from another file, which all run on promises
utils folder function
export const GetData = async (
xx: string[],
endpointOne: boolean,
) => {
if (endpointOne) {
return getDataFromEndpointOne(xx)
}
return getDataFromEndpointTwo(xx)
}
example of endpoint
const getDataFromEndpointOne = (
xx: string[],
): Promise<any> =>
Request(
`/endpoint1/${xx}`,
);
But in the main folder that's calling the utils folder function, it always (always) returns pending no matter what I try
const data =
getData(
["1", "3", "56"],
true
).then(result => { return result })