|
@@ -135,6 +135,7 @@
|
|
|
showRemoveProfilePictureModal: false,
|
|
|
dragging: false,
|
|
|
dataURL: null,
|
|
|
+ file: null,
|
|
|
loading: false
|
|
|
}
|
|
|
}
|
|
@@ -163,9 +164,14 @@
|
|
|
uploadProfilePicture () {
|
|
|
this.picture.loading = true
|
|
|
|
|
|
+ let formData = new FormData()
|
|
|
+ formData.append('picture', this.picture.file)
|
|
|
+
|
|
|
this.axios
|
|
|
- .post('/api/v1/user/' + this.$store.state.username + '/picture', {
|
|
|
- picture: this.picture.dataURL
|
|
|
+ .post('/api/v1/user/' + this.$store.state.username + '/picture', formData, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'multipart/form-data'
|
|
|
+ }
|
|
|
})
|
|
|
.then(res => {
|
|
|
this.hideProflePictureModal()
|
|
@@ -215,9 +221,10 @@
|
|
|
},
|
|
|
processImage (file) {
|
|
|
let reader = new FileReader()
|
|
|
-
|
|
|
reader.readAsDataURL(file)
|
|
|
|
|
|
+ this.picture.file = file
|
|
|
+
|
|
|
reader.addEventListener('load', () => {
|
|
|
this.picture.dataURL = reader.result
|
|
|
})
|