feat(fe): store dark mode flag in local storage

This commit is contained in:
Denis Gukov 2022-06-23 20:00:45 +05:00
parent 9395049087
commit d416c82ad4

View File

@ -105,7 +105,7 @@
<v-navigation-drawer
app
dark
:color="$vuetify.theme.dark ? '#003236' : '#005057'"
:color="darkMode ? '#003236' : '#005057'"
fixed
width="260"
v-model="drawer"
@ -276,7 +276,7 @@
<v-list class="pa-0">
<v-list-item>
<v-switch
v-model="$vuetify.theme.dark"
v-model="darkMode"
inset
label="Dark Mode"
persistent-hint
@ -573,6 +573,7 @@ export default {
taskLogDialog: null,
task: null,
template: null,
darkMode: false,
};
},
@ -595,6 +596,15 @@ export default {
}
}
},
darkMode(val) {
this.$vuetify.theme.dark = val;
if (val) {
localStorage.setItem('darkMode', '1');
} else {
localStorage.removeItem('darkMode');
}
},
},
computed: {
@ -631,6 +641,10 @@ export default {
return;
}
if (localStorage.getItem('darkMode') === '1') {
this.darkMode = true;
}
try {
await this.loadData();
this.state = 'success';