diff --git a/src/plugins/user/components/settings/Main.vue b/src/plugins/user/components/settings/Main.vue
index f507a78..b3b69ff 100644
--- a/src/plugins/user/components/settings/Main.vue
+++ b/src/plugins/user/components/settings/Main.vue
@@ -1,94 +1,90 @@
-
-
-
-
-
-
-
-
-
- {{ item.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -96,29 +92,31 @@
import { computed, defineComponent, ref } from '@vue/composition-api';
export default defineComponent({
name: 'Main',
- setup(_, { root: { $store }, refs }) {
+ setup(_, { root: { $store } }) {
const user = computed(() => {
return $store.getters['user/user'];
});
- const firstname = ref(user.value.firstname);
- const lastname = ref(user.value.lastname);
- const mail = ref(user.value.mail);
- const display_name = ref(user.value.display_name);
+ const firstname = ref(user.value.firstname);
+ const lastname = ref(user.value.lastname);
+ const mail = ref(user.value.mail);
+ const display_name = ref(user.value.display_name);
- const password = ref('');
- const new_password = ref('');
- const new_password2 = ref('');
+ const password = ref('');
+ const new_password = ref('');
+ const new_password2 = ref('');
function save() {
- let change_values = {
+ let change_values: { [index: string]: string } = {
firstname: firstname.value,
lastname: lastname.value,
mail: mail.value,
display_name: display_name.value
};
Object.keys(change_values).forEach(key => {
- if (change_values[key] === user.value[key]) {
+ if (
+ change_values[key] === (<{ [index: string]: any }>user.value)[key]
+ ) {
delete change_values[key];
}
});
@@ -130,14 +128,9 @@ export default defineComponent({
new_password: new_password.value
});
}
- if (
- Object.keys(refs).every(key => {
- return refs[key].validate();
- })
- ) {
- $store.dispatch('user/updateUser', change_values);
- resetPassword();
- }
+ $store.dispatch('user/updateUser', change_values).catch(error => {
+ console.warn(error);
+ });
}
function reset() {
@@ -148,27 +141,9 @@ export default defineComponent({
password.value = '';
new_password.value = '';
new_password2.value = '';
- setTimeout(() => {
- Object.keys(refs).forEach(key => {
- refs[key].resetValidation();
- });
- }, 500);
}
- function resetPassword() {
- password.value = '';
- new_password.value = '';
- new_password2.value = '';
- console.log(refs);
- console.log(refs.ref_password);
- console.log(refs.ref_new_password);
- setTimeout(() => {
- refs.ref_password.resetValidation();
- refs.ref_new_password.resetValidation();
- }, 1000);
- }
-
- function samePassword(val) {
+ function samePassword(val: string) {
return val == new_password.value || 'Passwörter sind nicht identisch!';
}
@@ -176,7 +151,7 @@ export default defineComponent({
return !!val || 'Feld darf nicht leer sein!';
}
- function isEmail(val) {
+ function isEmail(val: string | null) {
return (
!val ||
/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w\w+)+$/.test(val) ||