mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 05:50:22 +00:00
12d9ef34f0
As is this has no effect, other than looking weird in html: <div settings-form="[object HTMLFormElement]"><div><h2>Native app</h2>
56 lines
1.2 KiB
Vue
56 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>
|