fix(tradein-fe): scraper-страница падала — scraper-settings {settings:[]} + string delay (#872)
All checks were successful
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Successful in 1m38s
Deploy Trade-In / deploy (push) Successful in 46s
All checks were successful
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Successful in 1m38s
Deploy Trade-In / deploy (push) Successful in 46s
Co-authored-by: bot-frontend <bot-frontend@gendsgn.local> Co-committed-by: bot-frontend <bot-frontend@gendsgn.local>
This commit is contained in:
parent
65b9247369
commit
1684c6ed3e
2 changed files with 13 additions and 3 deletions
|
|
@ -88,7 +88,13 @@ function useScraperSettings() {
|
||||||
return useQuery<ScraperSetting[]>({
|
return useQuery<ScraperSetting[]>({
|
||||||
queryKey: ["scraper-settings"],
|
queryKey: ["scraper-settings"],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
apiFetch<ScraperSetting[]>("/api/v1/admin/scraper-settings"),
|
apiFetch<{ settings: ScraperSetting[] }>("/api/v1/admin/scraper-settings").then(
|
||||||
|
(r) =>
|
||||||
|
(r.settings ?? []).map((s) => ({
|
||||||
|
...s,
|
||||||
|
request_delay_sec: Number(s.request_delay_sec),
|
||||||
|
})),
|
||||||
|
),
|
||||||
staleTime: 30_000,
|
staleTime: 30_000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -532,7 +538,7 @@ export default function CianScraperPage() {
|
||||||
)}
|
)}
|
||||||
{updateSettingMut.isSuccess && updateSettingMut.data && (
|
{updateSettingMut.isSuccess && updateSettingMut.data && (
|
||||||
<div className="scraper-result">
|
<div className="scraper-result">
|
||||||
Delay обновлён: <strong>{updateSettingMut.data.request_delay_sec.toFixed(1)} сек</strong>{" "}
|
Delay обновлён: <strong>{Number(updateSettingMut.data.request_delay_sec).toFixed(1)} сек</strong>{" "}
|
||||||
(обновлено {formatTime(updateSettingMut.data.updated_at)})
|
(обновлено {formatTime(updateSettingMut.data.updated_at)})
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,11 @@ function useScraperSettings() {
|
||||||
queryKey: ["scraper-settings"],
|
queryKey: ["scraper-settings"],
|
||||||
queryFn: () =>
|
queryFn: () =>
|
||||||
apiFetch<{ settings: ScraperSetting[] }>("/api/v1/admin/scraper-settings").then(
|
apiFetch<{ settings: ScraperSetting[] }>("/api/v1/admin/scraper-settings").then(
|
||||||
(r) => r.settings,
|
(r) =>
|
||||||
|
(r.settings ?? []).map((s) => ({
|
||||||
|
...s,
|
||||||
|
request_delay_sec: Number(s.request_delay_sec),
|
||||||
|
})),
|
||||||
),
|
),
|
||||||
refetchInterval: 30_000,
|
refetchInterval: 30_000,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue