implemented mode change
This commit is contained in:
@ -2,13 +2,12 @@
|
||||
<section id="content">
|
||||
<div id="content-header">
|
||||
<router-link to="/solutions" class="button" id="solutions-button" @click="defaultSolutionPage()">
|
||||
<h1 :class="[darkMode ? 'h1-darkmode' : 'h1-lightmode']" id="page-name">Solutions</h1>
|
||||
<h1 :class="[loggedInUserDarkModeBoolean ? 'h1-darkmode' : 'h1-lightmode']" id="page-name">Solutions</h1>
|
||||
</router-link>
|
||||
</div>
|
||||
<div id="content-body">
|
||||
<CustomerSearch v-if="onSolutionlist" />
|
||||
<SolutionTable v-if="onSolutionlist" />
|
||||
<!-- <SolutionTableNoCustomer v-if="onCustomerSolutionlist" /> -->
|
||||
<Solution v-if="onSolution" />
|
||||
<SolutionChecklist v-if="onSolution" />
|
||||
</div>
|
||||
@ -16,20 +15,19 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import CustomerSearch from "../components/CustomerSearch.vue";
|
||||
import SolutionTable from "../components/server/SolutionTable.vue";
|
||||
// import SolutionTableNoCustomer from "../components/server/SolutionTableNoCustomer.vue";
|
||||
import Solution from "../components/server/Solution.vue";
|
||||
import SolutionChecklist from "../components/server/SolutionChecklist.vue";
|
||||
import { useStore } from 'vuex';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const store = useStore();
|
||||
const modeChanged = computed(() => store.state.updateDarkMode);
|
||||
const onSolutionlist = computed(() => store.state.onSolutionlist);
|
||||
// const onCustomerSolutionlist = computed(() => store.state.onCustomerSolutionlist);
|
||||
const onSolution = computed(() => store.state.onSolution);
|
||||
const loggedInUserDarkModeBoolean = ref('');
|
||||
|
||||
definePageMeta({
|
||||
layout: 'default',
|
||||
@ -41,7 +39,28 @@ const defaultSolutionPage = () => {
|
||||
store.commit('changeToSolutionlist')
|
||||
}
|
||||
|
||||
const darkMode = ref(true)
|
||||
const getSession = async () => {
|
||||
const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
|
||||
if (loggedInUserDarkModeBool == 1) {
|
||||
loggedInUserDarkModeBoolean.value = true;
|
||||
} else {
|
||||
loggedInUserDarkModeBoolean.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getItem(item) {
|
||||
if (process.client) {
|
||||
return localStorage.getItem(item)
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
watch(modeChanged, getSession)
|
||||
|
||||
onMounted(async () => {
|
||||
await getSession();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user