I'm making a API call/fetch(), to check a user's logged in status and I need to return true or false from the fetch.  (Don't ask why, I just need to do this specifically for a project at work, so must be done this way).
I have some code below:
- which returns a fetch
- And returns the response successfully, outside the main function checkLoggedInStatus().
- However, if the logged in status === NotloggedIn, I want to returntrue.
In this example below, my code returns NotloggedIn.  But does not return true.
How can I do this?
function checkLoggedInStatus() {
    let data;
    return fetch("www.MYAPI.com")
        .then((response) => response.text())
        .then((result) => {
            data = JSON.parse(result);
            return data;
        })
        .catch((error) => console.log("error", error));
};
checkLoggedInStatus().then(data => {
    console.log("data.Status", data);
    if (data === "NotLoggedIn") {
        return true;
    } else {
        return false
    };
})
 
    