-
+
-
+
{{ user.location.name }}
-
+
@@ -112,11 +75,7 @@
-
+
-
+
@@ -174,6 +133,18 @@ export default {
if (!(id && slug)) return ''
return { name: 'profile-id-slug', params: { slug, id } }
}
+ },
+ methods: {
+ // TODO method this is a duplicate from /pages/profile/_id/_slug.vue
+ // where to put this?
+ userName(maxLength) {
+ // Return Anonymous if no Username is given
+ if (!this.user.name) {
+ return this.$t('profile.userAnonym')
+ }
+ // Return full Username or truncated Username
+ return maxLength ? this.user.name.substring(0, maxLength) : this.user.name
+ }
}
}
diff --git a/webapp/locales/de.json b/webapp/locales/de.json
index 030f88abf..6e81014a9 100644
--- a/webapp/locales/de.json
+++ b/webapp/locales/de.json
@@ -29,9 +29,10 @@
"data": {
"name": "Deine Daten",
"labelName": "Dein Name",
- "namePlaceholder": "Anonymus",
+ "namePlaceholder": "Petra Lustig",
"labelCity": "Deine Stadt oder Region",
- "labelBio": "Über dich"
+ "labelBio": "Über dich",
+ "success": "Deine Daten wurden erfolgreich aktualisiert!"
},
"security": {
"name": "Sicherheit",
diff --git a/webapp/locales/en.json b/webapp/locales/en.json
index dc44bd2ba..0c7c4df83 100644
--- a/webapp/locales/en.json
+++ b/webapp/locales/en.json
@@ -29,9 +29,10 @@
"data": {
"name": "Your data",
"labelName": "Your Name",
- "namePlaceholder": "Anonymous",
+ "namePlaceholder": "Femanon Funny",
"labelCity": "Your City or Region",
- "labelBio": "About You"
+ "labelBio": "About You",
+ "success": "Your data was successfully updated!"
},
"security": {
"name": "Security",
diff --git a/webapp/pages/settings/index.vue b/webapp/pages/settings/index.vue
index 3acaf9c4c..b73e830d0 100644
--- a/webapp/pages/settings/index.vue
+++ b/webapp/pages/settings/index.vue
@@ -1,8 +1,5 @@
-
+
@@ -36,11 +33,9 @@
style="float: right;"
icon="check"
type="submit"
- :loading="sending"
+ :loading="loadingData"
primary
- >
- {{ $t('actions.save') }}
-
+ >{{ $t('actions.save') }}
@@ -88,8 +83,8 @@ export default {
return {
axiosSource: null,
cities: [],
- sending: false,
- loading: false,
+ loadingData: false,
+ loadingGeo: false,
formData: {}
}
},
@@ -111,13 +106,13 @@ export default {
...mapMutations({
setCurrentUser: 'auth/SET_USER'
}),
- submit() {
- this.sending = true
+ async submit() {
+ this.loadingData = true
const { name, about } = this.formData
let { locationName } = this.formData
locationName = locationName && (locationName['label'] || locationName)
- this.$apollo
- .mutate({
+ try {
+ const { data } = await this.$apollo.mutate({
mutation,
variables: {
id: this.currentUser.id,
@@ -135,15 +130,12 @@ export default {
})
}
})
- .then(data => {
- this.$toast.success('Updated user')
- })
- .catch(err => {
- this.$toast.error(err.message)
- })
- .finally(() => {
- this.sending = false
- })
+ this.$toast.success(this.$t('settings.data.success'))
+ } catch (err) {
+ this.$toast.error(err.message)
+ } finally {
+ this.loadingData = false
+ }
},
handleCityInput(value) {
clearTimeout(timeout)
@@ -181,7 +173,7 @@ export default {
return
}
- this.loading = true
+ this.loadingGeo = true
this.axiosSource = CancelToken.source()
const place = encodeURIComponent(value)
@@ -198,7 +190,7 @@ export default {
this.cities = this.processCityResults(res)
})
.finally(() => {
- this.loading = false
+ this.loadingGeo = false
})
}
}