Parcourir la source

fix(Settings/Preferences): current nightmode status not being reflected on initial load

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan il y a 4 ans
Parent
commit
8462ba6ff6
2 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 2 0
      frontend/src/App.vue
  2. 3 0
      frontend/src/pages/Settings/tabs/Preferences.vue

+ 2 - 0
frontend/src/App.vue

@@ -79,7 +79,9 @@ export default {
 	beforeMount() {
 		const nightmode =
 			false || JSON.parse(localStorage.getItem("nightmode"));
+
 		this.changeNightmode(nightmode);
+
 		if (nightmode) this.enableNightMode();
 		else this.disableNightMode();
 	},

+ 3 - 0
frontend/src/pages/Settings/tabs/Preferences.vue

@@ -25,6 +25,9 @@ export default {
 	computed: mapState({
 		nightmode: state => state.user.preferences.nightmode
 	}),
+	mounted() {
+		this.localNightmode = this.nightmode;
+	},
 	methods: {
 		saveChanges() {
 			if (this.localNightmode !== this.nightmode)