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

This commit is contained in:
Mark Haines 2015-07-22 09:43:40 +01:00
parent 79e03597b3
commit e1aca588b5

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);