2019-02-28 06:38:10 +11:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2019-03-01 04:53:37 +11:00
|
|
|
const followRequestFetcher = {
|
2019-02-28 06:38:10 +11:00
|
|
|
startFetching
|
|
|
|
}
|
|
|
|
|
2019-03-01 04:53:37 +11:00
|
|
|
export default followRequestFetcher
|