Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove appUserId from storage if the user has a userId #591

Merged
merged 2 commits into from Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/frame/js/actions/conversation.js
Expand Up @@ -525,7 +525,14 @@ export function handleUserConversationResponse({appUser, conversation, hasPrevio
actions.push(setConfig(key, settings[key]));
}

storage.setItem(`${appId}.appUserId`, appUser._id);
if (appUser.userId) {
// if the user is identified using a userId,
// there's no need to persist or leave the appUserId
// in storage since it's useless without a jwt
storage.removeItem(`${appId}.appUserId`);
} else {
storage.setItem(`${appId}.appUserId`, appUser._id);
}

if (sessionToken) {
storage.setItem(`${appId}.sessionToken`, sessionToken);
Expand Down