Skip to content

Commit

Permalink
login token is stored in localStorage now, instead of sessionStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
yylyyl committed Nov 8, 2023
1 parent 1280732 commit 8856fd4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web/src/lib/dataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {receiveOnlyWebsocket} from "./wsHelper";

const prefix = '/api';
const sessionKeyName = 'containerup_key';
let loginKey = sessionStorage.getItem(sessionKeyName);
let loginKey = localStorage.getItem(sessionKeyName);

const errors = {
errNoLogin: new Error('not logged in'),
Expand All @@ -25,7 +25,7 @@ const login = (username, password) => {
})
.then(resp => {
loginKey = resp.data.key;
sessionStorage.setItem(sessionKeyName, loginKey);
localStorage.setItem(sessionKeyName, loginKey);
});
};

Expand All @@ -36,7 +36,7 @@ const logout = () => {
const key = loginKey;

loginKey = '';
sessionStorage.removeItem(sessionKeyName);
localStorage.removeItem(sessionKeyName);

return axios.post(prefix + '/logout', {
}, {
Expand Down

0 comments on commit 8856fd4

Please sign in to comment.