minor fixes

This commit is contained in:
nflnkr 2023-06-17 17:27:22 +03:00
parent 6b2803864e
commit 20687d8551
2 changed files with 4 additions and 3 deletions

@ -1,6 +1,7 @@
import { useEffect, useState } from "react";
import { makeRequest } from "../api";
import { Tariff, GetTariffsResponse } from "../model/tariff";
import { devlog } from "../utils";
export function useTariffs({ url, tariffsPerPage, apiPage, onNewTariffs, onError }: {
@ -22,13 +23,13 @@ export function useTariffs({ url, tariffsPerPage, apiPage, onNewTariffs, onError
useToken: true,
signal: controller.signal,
}).then((result) => {
// devlog("GetTicketsResponse", result);
devlog("GetTariffsResponse", result);
if (result.tariffs.length > 0) {
onNewTariffs(result.tariffs);
setFetchState("idle");
} else setFetchState("all fetched");
}).catch(error => {
console.log("Error fetching tariffs", error);
devlog("Error fetching tariffs", error);
onError(error);
});

@ -34,7 +34,7 @@ export function useTickets({ url, ticketsPerPage, ticketApiPage, onNewTickets, o
setFetchState("idle");
} else setFetchState("all fetched");
}).catch(error => {
console.log("Error fetching tickets", error);
devlog("Error fetching tickets", error);
onError(error);
});