release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
2 changed files with 112 additions and 35 deletions
Showing only changes of commit 925982d700 - Show all commits

View File

@ -4,15 +4,13 @@
<q-input
class="col-xs-12 col-sm-6 q-pa-sm"
label="Vorname"
readonly
:value="user.firstname"
v-model="firstname"
filled
/>
<q-input
class="col-xs-12 col-sm-6 q-pa-sm"
label="Nachname"
readonly
:value="user.lastname"
v-model="lastname"
filled
/>
<q-input
@ -25,8 +23,13 @@
<q-input
class="col-xs-12 col-sm-6 q-pa-sm"
label="E-Mail"
readonly
:value="user.mail"
v-model="mail"
filled
/>
<q-input
class="col-xs-12 col-sm-6 q-pa-sm"
label="Display Name"
v-model="display_name"
filled
/>
<q-select
@ -50,33 +53,91 @@
class="col-xs-12 col-sm-6 col-md-4 q-pa-sm"
label="Password"
type="password"
hint="Password muss immer eingetragen werden"
v-model="password"
filled
/>
<q-input
class="col-xs-12 col-sm-6 col-md-4 q-pa-sm"
label="Neues Password"
type="password"
v-model="new_password"
:rules="[samePassword]"
filled
/>
<q-input
class="col-xs-12 col-sm-6 col-md-4 q-pa-sm"
label="Wiederhole neues Password"
type="password"
v-model="new_password2"
:disable="new_password.length == 0"
:rules="[samePassword]"
filled
/>
</q-card-section>
<q-card-actions align="right">
<q-btn color="primary" label="Speichern" @click="save" />
</q-card-actions>
</q-card>
</template>
<script lang="ts">
import { computed, defineComponent } from '@vue/composition-api';
import { computed, defineComponent, ref } from '@vue/composition-api';
export default defineComponent({
name: 'Main',
setup(_, { root: { $store } }) {
const user = computed(() => {
return $store.getters['user/user'];
const user = computed<FG.User>(() => {
return <FG.User>$store.getters['user/user'];
});
return { 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 password = ref<string>('');
const new_password = ref<string>('');
const new_password2 = ref<string>('');
function save() {
let change_values = {
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]) {
delete change_values[key];
}
});
change_values = Object.assign(change_values, {
password: password.value
});
if (new_password.value != '') {
change_values = Object.assign(change_values, {
new_password: new_password.value
});
}
console.log(change_values);
$store.dispatch('user/updateUser', change_values);
}
function samePassword(val) {
return val == new_password.value || 'Passwörter sind nicht identisch!';
}
return {
user,
firstname,
lastname,
mail,
display_name,
password,
new_password,
new_password2,
samePassword,
save
};
}
});
</script>

View File

@ -92,17 +92,33 @@ const actions: ActionTree<UserStateInterface, StateInterface> = {
});
});
},
updateUser({ commit, getters }, data) {
commit('setLoginLoading', true);
axios
.put(`/users/${getters.user.userid}`, data)
.catch(error => {
console.log(error);
})
.finally(() => {
commit('setLoginLoading', false);
});
},
loadFromLocalStorage({ commit }) {
console.log('load from store');
let data = LocalStorage.getItem('user');
commit('setUser', data ? data : {
commit(
'setUser',
data
? data
: {
display_name: '',
firstname: '',
lastname: '',
mail: '',
roles: [],
userid: ''
});
}
);
data = LocalStorage.getItem('session');
commit(
'setSession',