logo

pleroma-fe

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

lists_fetcher.service.js (601B)


  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.fetchLists({ credentials })
  5. .then(lists => {
  6. store.commit('setLists', lists)
  7. }, () => {})
  8. .catch(() => {})
  9. }
  10. const startFetching = ({ credentials, store }) => {
  11. const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
  12. boundFetchAndUpdate()
  13. return promiseInterval(boundFetchAndUpdate, 240000)
  14. }
  15. const listsFetcher = {
  16. startFetching
  17. }
  18. export default listsFetcher