logo

pleroma-fe

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

lists_fetcher.service.js (646B)


  1. import { useListsStore } from 'src/stores/lists.js'
  2. import apiService from '../api/api.service.js'
  3. import { promiseInterval } from '../promise_interval/promise_interval.js'
  4. const fetchAndUpdate = ({ credentials }) => {
  5. return apiService.fetchLists({ credentials })
  6. .then(lists => {
  7. useListsStore().setLists(lists)
  8. }, () => {})
  9. .catch(() => {})
  10. }
  11. const startFetching = ({ credentials, store }) => {
  12. const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
  13. boundFetchAndUpdate()
  14. return promiseInterval(boundFetchAndUpdate, 240000)
  15. }
  16. const listsFetcher = {
  17. startFetching
  18. }
  19. export default listsFetcher