🚸 🐛 Fix HMR issues & change lang without reload
- Fix HMR issues due to circular import of "language" and "i18n" - Move i18n to seperate file - Dynamically update language instead of doing a full page reload
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { ref, watch, computed } from "vue";
|
||||
import router from "./router";
|
||||
import i18n from "./main";
|
||||
import { getNextAndPrevDay } from "./util";
|
||||
import i18n from "./i18n";
|
||||
|
||||
/* Router */
|
||||
export const lastRoute = ref();
|
||||
@ -14,7 +14,7 @@ export const classFilter = ref(localStorage.getItem("classFilter") || "none");
|
||||
export const timetableGroups = ref(
|
||||
JSON.parse(localStorage.getItem("timetableGroups") || "[]")
|
||||
);
|
||||
export const language = ref(localStorage.getItem("lang") || "en");
|
||||
|
||||
export const theme = ref(localStorage.getItem("theme") || "auto");
|
||||
|
||||
watch(classFilter, (newValue) => {
|
||||
@ -24,10 +24,6 @@ watch(classFilter, (newValue) => {
|
||||
watch(timetableGroups, (newValue) => {
|
||||
localStorage.setItem("timetableGroups", JSON.stringify(newValue));
|
||||
});
|
||||
watch(language, (newValue) => {
|
||||
localStorage.setItem("lang", newValue);
|
||||
location.reload();
|
||||
});
|
||||
watch(theme, (newValue) => {
|
||||
localStorage.setItem("theme", newValue);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user