change chats to use custom makeFetcher

This commit is contained in:
Shpuld Shpuldson 2020-09-02 21:01:31 +03:00
parent 2d914c331e
commit 1b6eee0497
4 changed files with 10 additions and 11 deletions

View file

@ -6,7 +6,6 @@ export const makeFetcher = (call, interval) => {
func = () => {
call().finally(() => {
console.log('callbacks')
if (stopped) return
timeout = window.setTimeout(func, interval)
})
@ -14,7 +13,7 @@ export const makeFetcher = (call, interval) => {
const stopFetcher = () => {
stopped = true
window.cancelTimeout(timeout)
window.clearTimeout(timeout)
}
func()

View file

@ -1,5 +1,5 @@
import apiService from '../api/api.service.js'
import makeFetcher from '../fetcher/fetcher.js'
import { makeFetcher } from '../fetcher/fetcher.js'
const update = ({ store, notifications, older }) => {
store.dispatch('setNotificationsError', { value: false })