implemented mode change
This commit is contained in:
@ -350,13 +350,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import Axios from '../axios.config.js';
|
||||
import clientsideConfig from '../../clientsideConfig.js';
|
||||
import { useStore } from 'vuex';
|
||||
import { computed } from 'vue';
|
||||
|
||||
const store = useStore();
|
||||
const modeChanged = computed(() => store.state.updateDarkMode);
|
||||
|
||||
const editable = computed(() => store.state.editable);
|
||||
const chosenIssueSlipId = computed(() => store.state.chosenIssueSlipId);
|
||||
const addBool = computed(() => store.state.new);
|
||||
@ -388,7 +390,7 @@ const newIngressBillDate = ref('');
|
||||
const newEgressDate = ref('');
|
||||
const newEgressBillDate = ref('');
|
||||
|
||||
const darkMode = ref(true)
|
||||
const darkMode = ref('')
|
||||
const issueSlip = ref({});
|
||||
|
||||
// get issue slip from id
|
||||
@ -545,7 +547,27 @@ const addIssueSlip = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const getSession = async () => {
|
||||
const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
|
||||
if (loggedInUserDarkModeBool == 1) {
|
||||
darkMode.value = true;
|
||||
} else {
|
||||
darkMode.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getItem(item) {
|
||||
if (process.client) {
|
||||
return localStorage.getItem(item)
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
watch(modeChanged, getSession)
|
||||
|
||||
onMounted(async () => {
|
||||
await getSession();
|
||||
getIssueSlipById();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user