aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/settings/settings.js')
-rw-r--r--src/components/settings/settings.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js
index 998aa354..b8aa876b 100644
--- a/src/components/settings/settings.js
+++ b/src/components/settings/settings.js
@@ -7,6 +7,8 @@ const settings = {
hideAttachmentsLocal: this.$store.state.config.hideAttachments,
hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv,
hideNsfwLocal: this.$store.state.config.hideNsfw,
+ muteWordsString: this.$store.state.config.muteWords.join('\n'),
+ previewfile: null,
autoLoadLocal: this.$store.state.config.autoLoad,
hoverPreviewLocal: this.$store.state.config.hoverPreview,
muteWordsString: this.$store.state.config.muteWords.join('\n')
@@ -15,6 +17,40 @@ const settings = {
components: {
StyleSwitcher
},
+ computed: {
+ user () {
+ return this.$store.state.users.currentUser
+ }
+ },
+ methods: {
+ uploadAvatar ({target}) {
+ const file = target.files[0]
+ // eslint-disable-next-line no-undef
+ const reader = new FileReader()
+ reader.onload = ({target}) => {
+ const img = target.result
+ this.previewfile = img
+ /*this.$store.state.api.backendInteractor.updateAvatar({params: {img}}).then((user) => {
+ if (!user.error) {
+ this.$store.commit('addNewUsers', [user])
+ this.$store.commit('setCurrentUser', user)
+ }
+ })*/
+ }
+ reader.readAsDataURL(file)
+ },
+ submitAvatar () {
+ if (!this.previewfile)
+ return
+ const img = this.previewfile
+ this.$store.state.api.backendInteractor.updateAvatar({params: {img}}).then((user) => {
+ if (!user.error) {
+ this.$store.commit('addNewUsers', [user])
+ this.$store.commit('setCurrentUser', user)
+ }
+ })
+ }
+ },
watch: {
hideAttachmentsLocal (value) {
this.$store.dispatch('setOption', { name: 'hideAttachments', value })