Add debounce to API request

This commit is contained in:
Sol Fisher Romanoff 2022-06-22 19:42:27 +03:00
parent 9923ff587b
commit fb2fc686b1
Signed by untrusted user who does not match committer: nbsp
GPG key ID: 9D3F2B64F2341B62

View file

@ -7,6 +7,7 @@ import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
import RichContent from 'src/components/rich_content/rich_content.jsx' import RichContent from 'src/components/rich_content/rich_content.jsx'
import List from '../list/list.vue' import List from '../list/list.vue'
import withLoadMore from '../../hocs/with_load_more/with_load_more' import withLoadMore from '../../hocs/with_load_more/with_load_more'
import { debounce } from 'lodash'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { import {
faCircleNotch faCircleNotch
@ -151,9 +152,9 @@ const UserProfile = {
window.open(target.href, '_blank') window.open(target.href, '_blank')
} }
}, },
setNote () { setNote: debounce(function () {
this.$store.dispatch('setNote', { id: this.userId, note: this.note }) this.$store.dispatch('setNote', { id: this.userId, note: this.note })
} }, 1500)
}, },
watch: { watch: {
'$route.params.id': function (newVal) { '$route.params.id': function (newVal) {