aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_settings/user_settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/user_settings/user_settings.js')
-rw-r--r--src/components/user_settings/user_settings.js24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index d5db4c2d..ced3efaa 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -18,6 +18,7 @@ import Importer from '../importer/importer.vue'
import Exporter from '../exporter/exporter.vue'
import withSubscription from '../../hocs/with_subscription/with_subscription'
import userSearchApi from '../../services/new_api/user_search.js'
+import Mfa from './mfa.vue'
const BlockList = withSubscription({
fetch: (props, $store) => $store.dispatch('fetchBlocks'),
@@ -46,7 +47,9 @@ const UserSettings = {
pickAvatarBtnVisible: true,
bannerUploading: false,
backgroundUploading: false,
+ banner: null,
bannerPreview: null,
+ background: null,
backgroundPreview: null,
bannerUploadError: null,
backgroundUploadError: null,
@@ -76,7 +79,8 @@ const UserSettings = {
MuteCard,
ProgressButton,
Importer,
- Exporter
+ Exporter,
+ Mfa
},
computed: {
user () {
@@ -212,22 +216,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