implemented mode change
This commit is contained in:
@ -150,6 +150,8 @@ import { useStore } from 'vuex';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const store = useStore();
|
||||
const modeChanged = computed(() => store.state.updateDarkMode);
|
||||
|
||||
const addBool = computed(() => store.state.new);
|
||||
const editable = computed(() => store.state.editable);
|
||||
|
||||
@ -168,7 +170,7 @@ const chosenSolId = computed(() => store.state.chosenSolutionId);
|
||||
const customerChanged = computed(() => store.state.customerChanged);
|
||||
const changedCustomerId = computed(() => store.state.changedCustomerId);
|
||||
|
||||
const darkMode = ref(true)
|
||||
const darkMode = ref('');
|
||||
const addRow = ref(false);
|
||||
const configItemList = ref([]);
|
||||
const solutions = ref([]);
|
||||
@ -419,11 +421,30 @@ const deleteSolTodo = async (id) => {
|
||||
await getSolutionTodosById();
|
||||
}
|
||||
|
||||
watch(customerChanged, getSolutionById);
|
||||
const getSession = async () => {
|
||||
const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
|
||||
if (loggedInUserDarkModeBool == 1) {
|
||||
darkMode.value = true;
|
||||
} else {
|
||||
darkMode.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getSolutionTodosById();
|
||||
getSolutionById();
|
||||
function getItem(item) {
|
||||
if (process.client) {
|
||||
return localStorage.getItem(item)
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
watch(customerChanged, getSolutionById);
|
||||
watch(modeChanged, getSession)
|
||||
|
||||
onMounted(async () => {
|
||||
getSession();
|
||||
await getSolutionTodosById();
|
||||
await getSolutionById();
|
||||
triggerBackendCallsWithDelay(getAllSolutions);
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user