aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_settings
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2019-06-17 20:17:58 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2019-06-17 20:17:58 +0000
commitac46de3972851e12373f690d3ef70f31cc7db1ef (patch)
treeeda83032a5d3824d1a8d8cffcfa3834ad9c17460 /src/components/user_settings
parent8d2e63a8e4b51deb7efb1d4fbbd5e20dfb924e73 (diff)
parent22a33512087710e9ca6c898c2c8b4592ac73e32d (diff)
Merge branch 'mastoapi-login-and-config-fixes' into 'develop'
Mastoapi login and config fixes See merge request pleroma/pleroma-fe!833
Diffstat (limited to 'src/components/user_settings')
-rw-r--r--src/components/user_settings/user_settings.js20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index 69505806..37d9e61b 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -46,7 +46,9 @@ const UserSettings = {
pickAvatarBtnVisible: true,
bannerUploading: false,
backgroundUploading: false,
+ banner: null,
bannerPreview: null,
+ background: null,
backgroundPreview: null,
bannerUploadError: null,
backgroundUploadError: null,
@@ -198,22 +200,12 @@ const UserSettings = {
},
submitBg () {
if (!this.backgroundPreview) { return }
- let img = this.backgroundPreview
- // eslint-disable-next-line no-undef
- let imginfo = new Image()
- let cropX, cropY, cropW, cropH
- imginfo.src = img
- cropX = 0
- cropY = 0
- cropW = imginfo.width
- cropH = imginfo.width
+ let background = this.background
this.backgroundUploading = true
- this.$store.state.api.backendInteractor.updateBg({params: {img, cropX, cropY, cropW, cropH}}).then((data) => {
+ this.$store.state.api.backendInteractor.updateBg({ background }).then((data) => {
if (!data.error) {
- let clone = JSON.parse(JSON.stringify(this.$store.state.users.currentUser))
- clone.background_image = data.url
- this.$store.commit('addNewUsers', [clone])
- this.$store.commit('setCurrentUser', clone)
+ this.$store.commit('addNewUsers', [data])
+ this.$store.commit('setCurrentUser', data)
this.backgroundPreview = null
} else {
this.backgroundUploadError = this.$t('upload.error.base') + data.error