diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2019-06-17 20:17:58 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2019-06-17 20:17:58 +0000 |
| commit | ac46de3972851e12373f690d3ef70f31cc7db1ef (patch) | |
| tree | eda83032a5d3824d1a8d8cffcfa3834ad9c17460 /src/components/user_settings/user_settings.js | |
| parent | 8d2e63a8e4b51deb7efb1d4fbbd5e20dfb924e73 (diff) | |
| parent | 22a33512087710e9ca6c898c2c8b4592ac73e32d (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/user_settings.js')
| -rw-r--r-- | src/components/user_settings/user_settings.js | 20 |
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 |
