Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix bug causing user to log into previous account

dominik-zeglen1cbe5899f9b1
diff --git a/saleor/static/dashboard-next/auth/AuthProvider.tsx b/saleor/static/dashboard-next/auth/AuthProvider.tsx
index 02178aba50..1b50c17f3f 100644
--- a/saleor/static/dashboard-next/auth/AuthProvider.tsx
+++ b/saleor/static/dashboard-next/auth/AuthProvider.tsx
@@ -84,10 +84,11 @@ class AuthProvider extends React.Component<
if (user) {
setAuthToken(tokenAuth.data.tokenCreate.token, this.state.persistToken);
}
- }
- if (tokenVerify.data && tokenVerify.data.tokenVerify.user) {
- const user = tokenVerify.data.tokenVerify.user;
- this.setState({ user });
+ } else {
+ if (tokenVerify.data && tokenVerify.data.tokenVerify.user) {
+ const user = tokenVerify.data.tokenVerify.user;
+ this.setState({ user });
+ }
}
}