Skip to content

Commit

Permalink
Warm api on page load to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
kimfom01 committed Oct 17, 2024
1 parent a28b330 commit 4295c3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions front/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Footer } from "./components/Footer";
import { ResizeForm } from "./components/ResizeForm";
import { ShowDownloadLink } from "./components/ShowDownloadLink";
import { ConvertForm } from "./components/ConvertForm";
import { WarmApi } from "./components/WarmApi";

export const App = () => {
const [downloadUrl, setDownloadUrl] = useState("");
Expand All @@ -14,6 +15,7 @@ export const App = () => {
return (
<div className="container flex h-screen dark:text-white flex-col mx-auto p-4">
<Header />
<WarmApi />
<div className="flex justify-center h-full w-full">
<div className="flex flex-col gap-10 min-h-full w-full md:w-fit justify-center items-center">
<ShowDownloadLink downloadUrl={downloadUrl} />
Expand Down
7 changes: 7 additions & 0 deletions front/src/components/WarmApi.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import axios from "axios";
import { VITE_API_WARM } from "../utils/apiUtils";

export const WarmApi = () => {
axios.get(`${VITE_API_WARM}`);
return <></>;
};
1 change: 1 addition & 0 deletions front/src/utils/apiUtils.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const VITE_API_URL = import.meta.env.VITE_API_URL;
export const VITE_API_WARM = import.meta.env.VITE_API_WARM;
export const VITE_DOCS_URL = import.meta.env.VITE_DOCS_URL;

0 comments on commit 4295c3c

Please sign in to comment.