Skip to content

Commit

Permalink
fix(Home Page): Restore localStorage update method
Browse files Browse the repository at this point in the history
  • Loading branch information
danactive committed Jul 8, 2020
1 parent 3db3cc5 commit 723bf89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/app/utils/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getHostToken(host, storageType = null) {

if (host === 'local') {
const localValue = getFromStorage('local');
if (storageType === 'browser') {
if (localValue) {
return localValue;
}

Expand Down
9 changes: 3 additions & 6 deletions ui/app/utils/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ export function get(host) {
export function update(host, value) {
try {
if (localStorage) {
const json = JSON.parse(localStorage.getItem(hostKey));
if (json) {
json[host] = value;
localStorage.setItem(hostKey, JSON.stringify(json));
return;
}
const json = JSON.parse(localStorage.getItem(hostKey)) || {};
json[host] = value;
localStorage.setItem(hostKey, JSON.stringify(json));
}
} catch (e) {
const json = { [host]: value };
Expand Down

0 comments on commit 723bf89

Please sign in to comment.