feat(settings): make switch use the settings store

This commit is contained in:
2026-07-20 17:36:46 +02:00
parent 267f009d2f
commit 10dc005cce
+8 -4
View File
@@ -15,7 +15,7 @@ limitations under the License.
--> -->
<script setup> <script setup>
import { ref } from 'vue'; import { useSettingsStore } from '../stores/settingsStore';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
const { t } = useI18n(); const { t } = useI18n();
@@ -29,15 +29,19 @@ const props = defineProps({
} }
}); });
const enabled = ref(false); const store = useSettingsStore();
const toggle = function toggle () {
store.set(props.path, !store.get(props.path));
};
</script> </script>
<template> <template>
<div class="switch-container" @click="enabled = !enabled"> <div class="switch-container" @click="toggle">
<div> <div>
{{ t(props.setting.i18n) }} {{ t(props.setting.i18n) }}
</div> </div>
<div class="switch-wrapper" :class="{ enabled: enabled }"> <div class="switch-wrapper" :class="{ enabled: store.get(props.path) }">
<div class="switch-point"></div> <div class="switch-point"></div>
</div> </div>
</div> </div>