mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
do not try to post to /logout if not logged in and make it fire and forget (#6619)
This commit is contained in:
parent
25cd5e335b
commit
8b85265ca4
@ -200,16 +200,19 @@ export function isLoggedIn() {
|
||||
|
||||
/** Log out and delete session data */
|
||||
export async function logout() {
|
||||
try {
|
||||
await window.main.insomniaFetch({
|
||||
method: 'POST',
|
||||
path: '/auth/logout',
|
||||
sessionId: getCurrentSessionId(),
|
||||
});
|
||||
} catch (error) {
|
||||
// Not a huge deal if this fails, but we don't want it to prevent the
|
||||
// user from signing out.
|
||||
console.warn('Failed to logout', error);
|
||||
const sessionId = getCurrentSessionId();
|
||||
if (sessionId) {
|
||||
try {
|
||||
window.main.insomniaFetch({
|
||||
method: 'POST',
|
||||
path: '/auth/logout',
|
||||
sessionId,
|
||||
});
|
||||
} catch (error) {
|
||||
// Not a huge deal if this fails, but we don't want it to prevent the
|
||||
// user from signing out.
|
||||
console.warn('Failed to logout', error);
|
||||
}
|
||||
}
|
||||
|
||||
_unsetSessionData();
|
||||
|
Loading…
Reference in New Issue
Block a user