Logs out the current user by sending a request to the logout endpoint.

The function returns a promise that resolves to a boolean value:

  • true if the response status is 200 (OK), indicating a successful logout.
  • false otherwise, indicating that the logout attempt was unsuccessful.
const wasLoggedOut = await logout();
if (wasLoggedOut) {
console.log('User successfully logged out.');
} else {
console.log('Logout failed.');
}

Throws an error if the network request fails or if there are issues with the getRequest function.

  • Returns Promise<boolean>

    A promise that resolves to true if the logout was successful, otherwise false.