hardlounge/client/components/Windows/Settings.vue
Reto Brunner 12d9ef34f0 Client/Settings: Remove bogus settings-form prop
As is this has no effect, other than looking weird in html:
<div settings-form="[object HTMLFormElement]"><div><h2>Native app</h2>
2023-04-29 11:52:34 +02:00

57 lines
1.2 KiB
Vue

<template>
<div id="settings" class="window" role="tabpanel" aria-label="Settings">
<div class="header">
<SidebarToggle />
</div>
<Navigation />
<div class="container">
<form ref="settingsForm" autocomplete="off" @change="onChange" @submit.prevent>
<router-view></router-view>
</form>
</div>
</div>
</template>
<script lang="ts">
import {defineComponent} from "vue";
import SidebarToggle from "../SidebarToggle.vue";
import Navigation from "../Settings/Navigation.vue";
import {useStore} from "../../js/store";
export default defineComponent({
name: "Settings",
components: {
SidebarToggle,
Navigation,
},
setup() {
const store = useStore();
const onChange = (event: Event) => {
const ignore = ["old_password", "new_password", "verify_password"];
const name = (event.target as HTMLInputElement).name;
if (ignore.includes(name)) {
return;
}
let value: boolean | string;
if ((event.target as HTMLInputElement).type === "checkbox") {
value = (event.target as HTMLInputElement).checked;
} else {
value = (event.target as HTMLInputElement).value;
}
void store.dispatch("settings/update", {name, value, sync: true});
};
return {
onChange,
};
},
});
</script>