akkoma-fe/src/services/follow_request_fetcher/follow_request_fetcher.service.js

23 lines
636 B
JavaScript
Raw Normal View History

import apiService from '../api/api.service.js'
import { makeFetcher } from '../fetcher/fetcher.js'
const fetchAndUpdate = ({ store, credentials }) => {
return apiService.fetchFollowRequests({ credentials })
.then((requests) => {
store.commit('setFollowRequests', requests)
2020-07-02 09:19:33 +00:00
store.commit('addNewUsers', requests)
}, () => {})
.catch(() => {})
}
2019-07-05 07:02:14 +00:00
const startFetching = ({ credentials, store }) => {
const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
return makeFetcher(boundFetchAndUpdate, 10000)
}
2019-02-28 17:53:37 +00:00
const followRequestFetcher = {
startFetching
}
2019-02-28 17:53:37 +00:00
export default followRequestFetcher