hardlounge/client/components/Windows/Settings.vue

49 lines
962 B
Vue
Raw Normal View History

2019-02-18 09:18:32 +00:00
<template>
2019-08-03 19:03:45 +00:00
<div id="settings" class="window" role="tabpanel" aria-label="Settings">
2019-02-18 09:18:32 +00:00
<div class="header">
<SidebarToggle />
2019-02-18 09:18:32 +00:00
</div>
<Navigation />
<div class="container">
<form ref="settingsForm" autocomplete="off" @change="onChange" @submit.prevent>
<router-view></router-view>
</form>
</div>
2019-02-18 09:18:32 +00:00
</div>
</template>
<script>
import SidebarToggle from "../SidebarToggle.vue";
import Navigation from "../Settings/Navigation.vue";
2019-11-15 19:13:26 +00:00
2019-02-18 09:18:32 +00:00
export default {
name: "Settings",
components: {
SidebarToggle,
Navigation,
},
2019-02-18 09:18:32 +00:00
methods: {
onChange(event) {
2019-08-03 19:03:45 +00:00
const ignore = ["old_password", "new_password", "verify_password"];
2019-02-18 09:18:32 +00:00
const name = event.target.name;
2019-02-18 09:18:32 +00:00
if (ignore.includes(name)) {
return;
}
let value;
if (event.target.type === "checkbox") {
value = event.target.checked;
} else {
value = event.target.value;
}
this.$store.dispatch("settings/update", {name, value, sync: true});
},
2019-02-18 09:18:32 +00:00
},
};
</script>