From 175124bcc5274b24dbc8eaf47c5d737f8ba27ad0 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Tue, 5 Dec 2023 05:55:39 +0100 Subject: [PATCH] Add comment and remove accidental comment --- components/switch-account.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/switch-account.js b/components/switch-account.js index 3ba83d3f..717666a9 100644 --- a/components/switch-account.js +++ b/components/switch-account.js @@ -41,9 +41,11 @@ export const AccountProvider = ({ children }) => { }, [setAccounts]) const multiAuthSignout = useCallback(async () => { - // document.cookie = 'multi_auth.user-id=' // switch to next available account const { status } = await fetch('/api/signout', { credentials: 'include' }) + // if status is 201, this mean the server was able to switch us to the next available account + // and the current account was simply removed from the list of available accounts including the corresponding JWT. + // -> update needed to sync state with cookies if (status === 201) updateAccountsFromCookie() return status }, [updateAccountsFromCookie])