Fix session issues

Close #809

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-08-13 17:47:26 +02:00
parent e781fd5b49
commit 5b1ae688d2
4 changed files with 56 additions and 24 deletions

View File

@@ -95,14 +95,17 @@ export async function initializeCurrentActor(
}
export async function logout(
apollo: ApolloClient<NormalizedCacheObject>
apollo: ApolloClient<NormalizedCacheObject>,
performServerLogout = true
): Promise<void> {
await apollo.mutate({
mutation: LOGOUT,
variables: {
refreshToken: localStorage.getItem(AUTH_REFRESH_TOKEN),
},
});
if (performServerLogout) {
await apollo.mutate({
mutation: LOGOUT,
variables: {
refreshToken: localStorage.getItem(AUTH_REFRESH_TOKEN),
},
});
}
await apollo.mutate({
mutation: UPDATE_CURRENT_USER_CLIENT,