persist theme preference in localstorage to reduce dark/light flicker upon startup

This commit is contained in:
mosu forge 2018-10-26 18:08:50 -07:00 committed by mosu-forge
parent dd152d6bcb
commit 5370b0976f
2 changed files with 7 additions and 2 deletions

View File

@ -96,6 +96,7 @@ module.exports = function (ctx) {
plugins: [
"Notify",
"Loading",
"LocalStorage",
"Dialog"
]
// iconSet: ctx.theme.mat ? "material-icons" : "ionicons"

View File

@ -1,5 +1,5 @@
import { ipcRenderer } from "electron"
import { Notify, Dialog, Loading } from "quasar"
import { Notify, Dialog, Loading, LocalStorage } from "quasar"
import { SCEE } from "./SCEE-Node";
import * as WebSocket from "ws"
@ -12,13 +12,17 @@ export class Gateway {
this.token = null
this.scee = new SCEE()
let theme = LocalStorage.has("theme") ? LocalStorage.get.item("theme") : "light"
this.app.store.commit("gateway/set_app_data", {
config: {
appearance: {
theme: "dark"
theme
}
}
});
this.app.store.watch( state => state.gateway.app.config.appearance.theme, (theme) => {
LocalStorage.set("theme", theme)
})
this.closeDialog = false