Save creds to localstorage

This commit is contained in:
David Baker 2015-06-12 13:12:39 +01:00
parent 22e18471db
commit e28fde7ae1
3 changed files with 27 additions and 1 deletions

View file

@ -3,6 +3,20 @@ var Matrix = require("matrix-js-sdk");
var matrixClient = null;
var localStorage = window.localStorage;
if (localStorage) {
var hs_url = localStorage.getItem("mx_hs_url");
var access_token = localStorage.getItem("mx_access_token");
var user_id = localStorage.getItem("mx_user_id");
if (access_token && user_id && hs_url) {
matrixClient = Matrix.createClient({
baseUrl: hs_url,
accessToken: access_token,
userId: user_id
});
}
}
module.exports = {
get: function() {
return matrixClient;