logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

follow_request_fetcher.service.js (686B)


  1. import apiService from '../api/api.service.js'
  2. import { promiseInterval } from '../promise_interval/promise_interval.js'
  3. const fetchAndUpdate = ({ store, credentials }) => {
  4. return apiService.fetchFollowRequests({ credentials })
  5. .then((requests) => {
  6. store.commit('setFollowRequests', requests)
  7. store.commit('addNewUsers', requests)
  8. }, () => {})
  9. .catch(() => {})
  10. }
  11. const startFetching = ({ credentials, store }) => {
  12. const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
  13. boundFetchAndUpdate()
  14. return promiseInterval(boundFetchAndUpdate, 10000)
  15. }
  16. const followRequestFetcher = {
  17. startFetching
  18. }
  19. export default followRequestFetcher