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