#388: get follow request on a real-time basis
parent
058238c3c6
commit
7c6446a9de
@ -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…
Reference in new issue