Make API requests to edit note

This commit is contained in:
Tusooa Zhu 2022-08-20 13:18:57 -04:00 committed by tusooa
commit 9f51517ecd
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 39 additions and 4 deletions

View file

@ -6,7 +6,8 @@ const UserNote = {
data () {
return {
localNote: '',
editing: false
editing: false,
frozen: false
}
},
computed: {
@ -23,7 +24,19 @@ const UserNote = {
this.editing = false
},
finalizeEditing () {
this.editing = false
this.frozen = true
this.$store.dispatch('editUserNote', {
id: this.user.id,
comment: this.localNote
})
.then(() => {
this.frozen = false
this.editing = false
})
.catch(() => {
this.frozen = false
})
}
}
}