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

24 lines
686 B
JavaScript
Raw Normal View History

import apiService from '../api/api.service.js'
2020-09-04 08:19:53 +00:00
import { promiseInterval } from '../promise_interval/promise_interval.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 })
boundFetchAndUpdate()
2020-09-04 08:19:53 +00:00
return promiseInterval(boundFetchAndUpdate, 10000)
}
2019-02-28 17:53:37 +00:00
const followRequestFetcher = {
startFetching
}
2019-02-28 17:53:37 +00:00
export default followRequestFetcher