I am trying to do below things. I want to get the current logged in user and pass the email to fetch url to get the data.

I fixed it by doing below change:





export function fetchdata() {

 return fetch("<API URL>", { method: 'get' })
        .then((response) => {
 return response.json()
                .then((json) => {
 return user.getEmail()
                        .then((email) => {
 return json[email];
                        });
                });
        });

}