backend code
export function fetchdata() {
return fetch('<API URL>', {method: 'get'})
.then(response => response.json())
.then((data) => {
user.getEmail()
.then( (email) => {
return data[email];
})
.then( (results) => {
return results;
} );
})
}
client side code
import { fetchdata } from 'backend/fetchTransaction';
$w.onReady( async function () {
fetchdata()
.then(items => console.log('-----------'+items));
} );
I am not getting the callback correctly in the client side