mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +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 */
|
/** Log out and delete session data */
|
||||||
export async function logout() {
|
export async function logout() {
|
||||||
try {
|
const sessionId = getCurrentSessionId();
|
||||||
await window.main.insomniaFetch({
|
if (sessionId) {
|
||||||
method: 'POST',
|
try {
|
||||||
path: '/auth/logout',
|
window.main.insomniaFetch({
|
||||||
sessionId: getCurrentSessionId(),
|
method: 'POST',
|
||||||
});
|
path: '/auth/logout',
|
||||||
} catch (error) {
|
sessionId,
|
||||||
// Not a huge deal if this fails, but we don't want it to prevent the
|
});
|
||||||
// user from signing out.
|
} catch (error) {
|
||||||
console.warn('Failed to logout', 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();
|
_unsetSessionData();
|
||||||
|
Loading…
Reference in New Issue
Block a user