mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update user profile data toats messages. Removed TestData fragments. removed unused components
This commit is contained in:
parent
3949b5ec36
commit
4045842435
@ -98,7 +98,6 @@ const loginAPI = {
|
||||
}
|
||||
return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload)
|
||||
},
|
||||
|
||||
changePassword: async (sessionId, email, password) => {
|
||||
const payload = {
|
||||
session_id: sessionId,
|
||||
|
||||
@ -109,7 +109,10 @@
|
||||
"chart":"Gemeinschaftsstunden Chart",
|
||||
"new":"Neue Gemeinschaftsstunden eintragen",
|
||||
"list":"Meine Gemeinschaftsstunden Liste"
|
||||
}
|
||||
},
|
||||
"user-data": {
|
||||
"change-success": "Deine Daten wurden gespeichert."
|
||||
}
|
||||
},
|
||||
"navbar" : {
|
||||
"my-profil":"Mein Profil",
|
||||
|
||||
@ -110,7 +110,10 @@
|
||||
"chart":"Community Hours Chart",
|
||||
"new":"Register new community hours",
|
||||
"list":"My Community Hours List"
|
||||
}
|
||||
},
|
||||
"user-data": {
|
||||
"change-success": "Your data has been saved."
|
||||
}
|
||||
},
|
||||
"navbar" : {
|
||||
"my-profil":"My profile",
|
||||
|
||||
@ -34,7 +34,6 @@
|
||||
:transactions="transactions"
|
||||
:transactionCount="transactionCount"
|
||||
:pending="pending"
|
||||
:UserProfileTestData="UserProfileTestData"
|
||||
@update-balance="updateBalance"
|
||||
@update-transactions="updateTransactions"
|
||||
></router-view>
|
||||
@ -86,11 +85,6 @@ export default {
|
||||
bookedBalance: 0,
|
||||
transactionCount: 0,
|
||||
pending: true,
|
||||
UserProfileTestData: {
|
||||
username: 'Mustermax',
|
||||
desc:
|
||||
'Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. Max Mustermann seine Beschreibung. ',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -61,12 +61,9 @@ export default {
|
||||
created() {},
|
||||
methods: {
|
||||
async onSubmit() {
|
||||
const result = await loginAPI.sendEmail(this.form.email)
|
||||
if (result.success) {
|
||||
this.$router.push('/thx/password')
|
||||
} else {
|
||||
this.$toast.success(this.$t('error.error'))
|
||||
}
|
||||
await loginAPI.sendEmail(this.form.email)
|
||||
// always give success to avoid email spying
|
||||
this.$router.push('/thx/password')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
|
||||
import UserProfile from './UserProfile'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
describe('UserProfile', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return shallowMount(UserProfile, { localVue })
|
||||
}
|
||||
|
||||
describe('shallowMount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the component', () => {
|
||||
expect(wrapper.findComponent({ name: 'user-card' }).exists()).toBeTruthy()
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -1,28 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="header pb-8 pt-5 pt-lg-8 d-flex align-items-center profile-header">
|
||||
<b-container fluid></b-container>
|
||||
</div>
|
||||
|
||||
<b-container fluid class="mt--6">
|
||||
<b-row>
|
||||
<b-col xl="12" class="order-xl-2 mb-5">
|
||||
<user-card :balance="balance"></user-card>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import UserCard from './UserProfile/UserCard.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
UserCard,
|
||||
},
|
||||
props: {
|
||||
balance: { type: Number, default: 0 },
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
@ -9,8 +9,8 @@
|
||||
<b-row class="text-right">
|
||||
<b-col class="mb-3">
|
||||
<b-icon
|
||||
v-if="editUserdata"
|
||||
@click="editUserdata = !editUserdata"
|
||||
v-if="showUserData"
|
||||
@click="showUserData = !showUserData"
|
||||
class="pointer"
|
||||
icon="pencil"
|
||||
>
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
<b-icon
|
||||
v-else
|
||||
@click="editUserdata = !editUserdata"
|
||||
@click="cancelEdit"
|
||||
class="pointer"
|
||||
icon="x-circle"
|
||||
variant="danger"
|
||||
@ -34,8 +34,8 @@
|
||||
<b-col class="col-lg-3 col-md-12 col-sm-12 text-md-left text-lg-right">
|
||||
<small>{{ $t('form.firstname') }}</small>
|
||||
</b-col>
|
||||
<b-col v-if="editUserdata" class="col-sm-10 col-md-9">
|
||||
{{ $store.state.firstName }}
|
||||
<b-col v-if="showUserData" class="col-sm-10 col-md-9">
|
||||
{{ form.firstName }}
|
||||
</b-col>
|
||||
<b-col v-else class="col-md-9 col-sm-10">
|
||||
<b-input type="text" v-model="form.firstName"></b-input>
|
||||
@ -45,8 +45,8 @@
|
||||
<b-col class="col-lg-3 col-md-12 col-sm-12 text-md-left text-lg-right">
|
||||
<small>{{ $t('form.lastname') }}</small>
|
||||
</b-col>
|
||||
<b-col v-if="editUserdata" class="col-sm-10 col-md-9">
|
||||
{{ $store.state.lastName }}
|
||||
<b-col v-if="showUserData" class="col-sm-10 col-md-9">
|
||||
{{ form.lastName }}
|
||||
</b-col>
|
||||
<b-col v-else class="col-md-9 col-sm-10">
|
||||
<b-input type="text" v-model="form.lastName"></b-input>
|
||||
@ -56,15 +56,15 @@
|
||||
<b-col class="col-lg-3 col-md-10 col-sm-10 text-md-left text-lg-right">
|
||||
<small>{{ $t('form.description') }}</small>
|
||||
</b-col>
|
||||
<b-col v-if="editUserdata" class="col-sm-10 col-md-9">
|
||||
{{ $store.state.description }}
|
||||
<b-col v-if="showUserData" class="col-sm-10 col-md-9">
|
||||
{{ form.description }}
|
||||
</b-col>
|
||||
<b-col v-else class="col-sm-10 col-md-9">
|
||||
<b-textarea rows="3" max-rows="6" v-model="form.description"></b-textarea>
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
<b-row class="text-right" v-if="!editUserdata">
|
||||
<b-row class="text-right" v-if="!showUserData">
|
||||
<b-col>
|
||||
<div class="text-right" ref="submitButton">
|
||||
<b-button
|
||||
@ -89,12 +89,9 @@ import loginAPI from '../../../apis/loginAPI'
|
||||
|
||||
export default {
|
||||
name: 'FormUserData',
|
||||
props: {
|
||||
UserProfileTestData: { type: Object },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editUserdata: true,
|
||||
showUserData: true,
|
||||
sessionId: this.$store.state.sessionId,
|
||||
form: {
|
||||
firstName: this.$store.state.firstName,
|
||||
@ -105,6 +102,12 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancelEdit() {
|
||||
this.form.firstName = this.$store.state.firstName
|
||||
this.form.lastName = this.$store.state.lastName
|
||||
this.form.description = this.$store.state.description
|
||||
this.showUserData = true
|
||||
},
|
||||
loadSubmitButton() {
|
||||
if (
|
||||
this.form.firstName !== this.$store.state.firstName ||
|
||||
@ -116,7 +119,8 @@ export default {
|
||||
this.loading = true
|
||||
}
|
||||
},
|
||||
async onSubmit() {
|
||||
async onSubmit(event) {
|
||||
event.preventDefault()
|
||||
const result = await loginAPI.updateUserInfos(
|
||||
this.$store.state.sessionId,
|
||||
this.$store.state.email,
|
||||
@ -130,10 +134,10 @@ export default {
|
||||
this.$store.commit('firstName', this.form.firstName)
|
||||
this.$store.commit('lastName', this.form.lastName)
|
||||
this.$store.commit('description', this.form.description)
|
||||
this.editUserdata = true
|
||||
alert('Deine Daten wurden gespeichert und sind geändert.')
|
||||
this.showUserData = true
|
||||
this.$toast.success(this.$t('site.profil.user-data.change-success'))
|
||||
} else {
|
||||
alert(result.result.message)
|
||||
this.$toast.error(result.result.message)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -73,9 +73,6 @@ export default {
|
||||
},
|
||||
}
|
||||
},
|
||||
props: {
|
||||
UserProfileTestData: { type: Object },
|
||||
},
|
||||
methods: {
|
||||
async onSubmit() {
|
||||
const result = await loginAPI.changeUsernameProfile(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<b-container fluid>
|
||||
<user-card :balance="balance" :transactionCount="transactionCount"></user-card>
|
||||
<form-user-data :UserProfileTestData="UserProfileTestData" />
|
||||
<form-user-data />
|
||||
<form-username />
|
||||
<form-user-passwort />
|
||||
</b-container>
|
||||
@ -22,7 +22,6 @@ export default {
|
||||
props: {
|
||||
balance: { type: Number, default: 0 },
|
||||
transactionCount: { type: Number, default: 0 },
|
||||
UserProfileTestData: { type: Object },
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user