Skip to content

Commit

Permalink
feat(storage): improve methods setUniversal and getUniversal
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroAS51 committed Mar 7, 2020
1 parent 1795c60 commit 12e30ec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lib/core/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ export default class Storage {
return this.removeUniversal(key)
}

// Local state
this.setState(key, value)

// Cookies
this.setCookie(key, value)

// Local Storage
this.setLocalStorage(key, value)

// Local state
this.setState(key, value)

return value
}

getUniversal (key) {
// Local state
let value = this.getState(key)

// Cookies
if (isUnset(value)) {
value = this.getCookie(key)
}
let value = this.getCookie(key)

// Local Storage
if (isUnset(value)) {
value = this.getLocalStorage(key)
}

// Local state
if (isUnset(value)) {
value = this.getState(key)
}

return value
}

Expand Down

0 comments on commit 12e30ec

Please sign in to comment.