Clear local storage *before* creating the client, Otherwise we will blow away anything that the client tried to persist after it was created

pull/1/head
Mark Haines 2015-07-22 09:43:40 +01:00
parent 79e03597b3
commit e1aca588b5
1 changed files with 7 additions and 1 deletions

View File

@ -76,10 +76,16 @@ module.exports = {
},
replaceUsingAccessToken: function(hs_url, is_url, user_id, access_token) {
createClient(hs_url, is_url, user_id, access_token);
if (localStorage) {
try {
localStorage.clear();
} catch (e) {
console.warn("Error using local storage");
}
}
createClient(hs_url, is_url, user_id, access_token);
if (localStorage) {
try {
localStorage.setItem("mx_hs_url", hs_url);
localStorage.setItem("mx_is_url", is_url);
localStorage.setItem("mx_user_id", user_id);