implemented mode change

This commit is contained in:
2024-03-25 23:23:37 +01:00
parent 45a4b58f26
commit 3f88f6b821
71 changed files with 3020 additions and 1006 deletions

View File

@ -70,16 +70,18 @@
<button :class="[darkMode ? 'saveNewItem-darkmode' : 'saveNewItem-lightmode']" @click="addItem()">Save</button>
</section>
</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 chosenAssetId = computed(() => store.state.chosenAssetId);
const addBool = computed(() => store.state.new);
@ -106,7 +108,7 @@ const newSoftware = computed(() => store.state.newSoftware);
const newVersion = computed(() => store.state.newVersion);
const newLicense = computed(() => store.state.newLicense);
const darkMode = ref(true)
const darkMode = ref('');
const item = ref({});
const networkBoolean = ref(false);
const inputIPv4 = ref('');
@ -356,7 +358,27 @@ const triggerBackendCallsWithDelay = async (fetchDataFunc) => {
}, 1000);
}
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(() => {
getSession();
triggerBackendCallsWithDelay(getItemById);
triggerBackendCallsWithDelay(getConfigItems);
});
@ -366,9 +388,9 @@ onMounted(() => {
export default {
name: "NetworkSpecifications",
};
</script>
</script>
<style scoped>
.network-information {
display: flex;