src/helpers/isTokenUserOnline.js
// check if the token and the id match a user in the data base that is currently logged in
check if the token and the id match a user in the data base that is currently logged in
check if the token and the id match a user in the data base that is currently logged in
function isTokenUserOnline() {
    const token = localStorage.getItem("token");
    const id = localStorage.getItem("id");
    if (isDefined(token) && isDefined(id)) {
        return callAPI(id).valueOf();
    } else {
        return false;
    }
}
function isTokenUserOnline ( ) { const token = localStorage . getItem ( "token" ) ; const id = localStorage . getItem ( "id" ) ; if ( isDefined ( token ) && isDefined ( id ) ) { return callAPI ( id ) . valueOf ( ) ; } else { return false ; } }
check if the token and the id match a user in the data base that is currently logged in
check if the token and the id match a user in the data base that is currently logged in
// call api to check if the token and id match a user in the database and check if that user is logged in // if no token or id is stored in the local storage, the user is not logged in