Make API requests to edit note
This commit is contained in:
parent
1101305ffb
commit
9f51517ecd
4 changed files with 39 additions and 4 deletions
|
|
@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<button
|
||||
v-show="editing"
|
||||
class="button-default btn"
|
||||
:disabled="frozen"
|
||||
@click="finalizeEditing"
|
||||
>
|
||||
{{ $t('user_card.edit_note_apply') }}
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
<button
|
||||
v-show="editing"
|
||||
class="button-default btn"
|
||||
:disabled="frozen"
|
||||
@click="cancelEditing"
|
||||
>
|
||||
{{ $t('user_card.edit_note_cancel') }}
|
||||
|
|
@ -30,9 +32,8 @@
|
|||
</div>
|
||||
<input
|
||||
v-show="editing"
|
||||
v-model="localNote"
|
||||
class="note-text"
|
||||
type="string"
|
||||
:model="localNote"
|
||||
>
|
||||
<span
|
||||
v-show="!editing"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue