From 1031352aa15882fd6c04c891ef0e61123740b146 Mon Sep 17 00:00:00 2001 From: euglena1215 Date: Sun, 27 Nov 2022 09:42:19 +0900 Subject: [PATCH] preload hero --- public/index.html | 1 + src/client/foundation/pages/Top/Top.jsx | 16 ++-------------- src/server/routes/api.js | 8 -------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/public/index.html b/public/index.html index a5815251b..819dc76e9 100644 --- a/public/index.html +++ b/public/index.html @@ -4,6 +4,7 @@ + CyberTicket diff --git a/src/client/foundation/pages/Top/Top.jsx b/src/client/foundation/pages/Top/Top.jsx index d19585ddb..687f00f4d 100644 --- a/src/client/foundation/pages/Top/Top.jsx +++ b/src/client/foundation/pages/Top/Top.jsx @@ -81,20 +81,8 @@ function useTodayRacesWithAnimation(races) { * @param {Model.Race[]} todayRaces * @returns {string | null} */ -function useHeroImage(todayRaces) { - const firstRaceId = todayRaces[0]?.id; - const url = - firstRaceId !== undefined - ? `/api/hero?firstRaceId=${firstRaceId}` - : "/api/hero"; - const { data } = useFetch(url, jsonFetcher); - - if (firstRaceId === undefined || data === null) { - return null; - } - - const imageUrl = `${data.url}?${data.hash}`; - return imageUrl; +function useHeroImage(_todayRaces) { + return "/assets/images/hero.jpg"; } /** @type {React.VFC} */ diff --git a/src/server/routes/api.js b/src/server/routes/api.js index 5e48d31cd..1231f0f29 100644 --- a/src/server/routes/api.js +++ b/src/server/routes/api.js @@ -1,7 +1,6 @@ import moment from "moment-timezone"; import { Between, LessThanOrEqual, MoreThanOrEqual } from "typeorm"; -import { assets } from "../../client/foundation/utils/UrlUtils.js"; import { BettingTicket, Race, User } from "../../model/index.js"; import { createConnection } from "../typeorm/connection.js"; import { initialize } from "../typeorm/initialize.js"; @@ -39,13 +38,6 @@ export const apiRoute = async (fastify) => { res.status(204).send(); }); - fastify.get("/hero", async (_req, res) => { - const url = assets("/images/hero.jpg"); - const hash = Math.random().toFixed(10).substring(2); - - res.send({ hash, url }); - }); - fastify.get("/races", async (req, res) => { const since = req.query.since != null ? moment.unix(req.query.since) : undefined;