diff --git a/src/pages/p2p/index.tsx b/src/pages/p2p/index.tsx index 7102d48..b17283d 100644 --- a/src/pages/p2p/index.tsx +++ b/src/pages/p2p/index.tsx @@ -12,7 +12,6 @@ import Popup from '@/components/UI/Popup/Popup'; import CreateOfferPopup from '@/components/default/CreateOfferPopup/CreateOfferPopup'; import Link from 'next/link'; import MainPageTitle from '@/components/default/MainPageTitle/MainPageTitle'; -import { GetServerSidePropsContext } from 'next'; import HomeProps from '@/interfaces/props/pages/p2p/HomeProps'; import OfferData from '@/interfaces/responses/offers/OfferData'; import { useRouter } from 'next/router'; @@ -103,8 +102,8 @@ function Home(props: HomeProps) { ); } -export async function getServerSideProps(context: GetServerSidePropsContext) { - const stats = await getStats(context.req.headers.host); +export async function getServerSideProps() { + const stats = await getStats(); return { props: { diff --git a/src/utils/methods.ts b/src/utils/methods.ts index f59e278..531fe08 100644 --- a/src/utils/methods.ts +++ b/src/utils/methods.ts @@ -74,8 +74,8 @@ export async function getPage( .then((res) => res.data); } -export async function getStats(host: string | undefined = undefined): Promise { - return (await fetch(`${host ? `https://${host}` : ''}/api/offers/get-stats`).then((res) => +export async function getStats(): Promise { + return (await fetch(`${baseUrl}/api/offers/get-stats`).then((res) => res.json(), )) as GetStatsRes; }