Skip to content

Commit

Permalink
Merge pull request #20 from ztalab/dev
Browse files Browse the repository at this point in the history
💄 default dark theme
  • Loading branch information
rovast authored May 7, 2022
2 parents a853f3f + 1700333 commit 90d71da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/top-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {
}
},
created() {
this.$vuetify.theme.dark = getCache('theme_dark')
this.$vuetify.theme.dark = getCache('theme_dark', true)
},
methods: {
handleLogout() {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export function setCache(k, v) {
window.localStorage.setItem(k, content)
}

export function getCache(k) {
export function getCache(k, defaultValue) {
const content = window.localStorage.getItem(k)
try {
const obj = JSON.parse(content)
return obj.value
} catch (e) {
return content
return defaultValue === undefined ? content : defaultValue
}
}

0 comments on commit 90d71da

Please sign in to comment.