diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 322b70f4..36ccd0a7 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -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);