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
200
false
const wasLoggedOut = await logout();if (wasLoggedOut) { console.log('User successfully logged out.');} else { console.log('Logout failed.');} Copy
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.
getRequest
A promise that resolves to true if the logout was successful, otherwise false.
Logs out the current user by sending a request to the logout endpoint.
The function returns a promise that resolves to a boolean value:
trueif the response status is200(OK), indicating a successful logout.falseotherwise, indicating that the logout attempt was unsuccessful.Example
Throws
Throws an error if the network request fails or if there are issues with the
getRequestfunction.