diff --git a/src/plugins/user/components/settings/MainUserSettings.vue b/src/plugins/user/components/settings/MainUserSettings.vue
index 1abf68c..373243f 100644
--- a/src/plugins/user/components/settings/MainUserSettings.vue
+++ b/src/plugins/user/components/settings/MainUserSettings.vue
@@ -1,8 +1,5 @@
-
+
-
+
@@ -109,15 +103,8 @@
/>
-
-
+
+
@@ -127,7 +114,7 @@ import {
computed,
defineComponent,
ref,
- onBeforeMount,
+ onBeforeMount
} from '@vue/composition-api';
import { Store } from 'vuex';
import { StateInterface } from 'src/store';
@@ -145,17 +132,17 @@ export default defineComponent({
components: { IsoDateInput: IsoDateInput },
props: {
user: {
- required: true,
+ required: true
},
newUser: {
- default: false,
- },
+ default: false
+ }
},
setup(props: Props, { root, emit }) {
const store = >root.$store;
onBeforeMount(() => {
- store.dispatch('user/getRoles', false).catch((error) => {
+ store.dispatch('user/getRoles', false).catch(error => {
console.warn(error);
});
});
@@ -169,7 +156,7 @@ export default defineComponent({
const oldUser = computed(() => {
if (isCurrentUser.value) return store.state.user.currentUser;
else
- return store.state.user.users.filter((user) => {
+ return store.state.user.users.filter(user => {
user.userid === props.user?.userid;
})[0];
});
@@ -182,13 +169,13 @@ export default defineComponent({
message: 'Datei zu groß oder keine gültige Bilddatei.',
timeout: 10000,
progress: true,
- actions: [{ icon: 'mdi-close', color: 'white' }],
+ actions: [{ icon: 'mdi-close', color: 'white' }]
});
avatar.value = [];
}
const allRoles = computed(() =>
- store.state.user.roles.map((role) => role.name)
+ store.state.user.roles.map(role => role.name)
);
const password = ref('');
const new_password = ref('');
@@ -199,20 +186,24 @@ export default defineComponent({
if (typeof changed.birthday === 'string')
changed.birthday = new Date(changed.birthday);
changed = Object.assign(changed, {
- password: password.value,
+ password: password.value
});
if (new_password.value != '') {
changed = Object.assign(changed, {
- new_password: new_password.value,
+ new_password: new_password.value
});
}
emit('update:user', changed);
- if (avatar.value && avatar.value.length > 0)
+
+ if (
+ avatar.value &&
+ (avatar.value.length > 0 || avatar.value instanceof File)
+ )
store
.dispatch('user/uploadAvatar', {
user: changed,
- file: avatar.value,
+ file: avatar.value
})
.catch((response: Response) => {
if (response && response.status == 400) {
@@ -270,8 +261,8 @@ export default defineComponent({
notEmpty,
isUseridUsed,
save,
- reset,
+ reset
};
- },
+ }
});
diff --git a/src/plugins/user/store/user.ts b/src/plugins/user/store/user.ts
index c1bc397..3c813f4 100644
--- a/src/plugins/user/store/user.ts
+++ b/src/plugins/user/store/user.ts
@@ -34,7 +34,6 @@ const mutations: MutationTree = {
setCurrentUser(state, data: FG.User) {
if (typeof data.birthday === 'string')
data.birthday = new Date(data.birthday);
- console.warn(data.birthday);
SessionStorage.set('currentUser', data);
state.currentUser = data;
},