#388: get follow request on a real-time basis
This commit is contained in:
parent
058238c3c6
commit
7c6446a9de
7 changed files with 42 additions and 13 deletions
|
@ -0,0 +1,21 @@
|
|||
import apiService from '../api/api.service.js'
|
||||
|
||||
const fetchAndUpdate = ({ store, credentials }) => {
|
||||
return apiService.fetchFollowRequests({ credentials })
|
||||
.then((requests) => {
|
||||
store.commit('setFollowRequests', requests)
|
||||
}, () => {})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const startFetching = ({credentials, store}) => {
|
||||
fetchAndUpdate({ credentials, store })
|
||||
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
|
||||
return setInterval(boundFetchAndUpdate, 10000)
|
||||
}
|
||||
|
||||
const requestFetcher = {
|
||||
startFetching
|
||||
}
|
||||
|
||||
export default requestFetcher
|
Loading…
Add table
Add a link
Reference in a new issue