diff --git a/web/src/stats/stats.ts b/web/src/stats/stats.ts index 1065c390d6..5b0b12b2ad 100644 --- a/web/src/stats/stats.ts +++ b/web/src/stats/stats.ts @@ -1378,11 +1378,13 @@ function get_chart_data( data, success(data) { callback(data); - update_last_full_update(data.end_times); + const {end_times} = z.object({end_times: z.array(z.number())}).parse(data); + update_last_full_update(end_times); }, error(xhr) { - if (xhr.responseJSON?.msg) { - $("#id_stats_errors").show().text(xhr.responseJSON.msg); + const parsed = z.object({msg: z.string()}).safeParse(xhr.responseJSON); + if (parsed.success) { + $("#id_stats_errors").show().text(parsed.data.msg); } }, });