commit
c0535f5140
2 changed files with 4 additions and 5 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ export async function getPage(
|
|||
.then((res) => res.data);
|
||||
}
|
||||
|
||||
export async function getStats(host: string | undefined = undefined): Promise<GetStatsRes> {
|
||||
return (await fetch(`${host ? `https://${host}` : ''}/api/offers/get-stats`).then((res) =>
|
||||
export async function getStats(): Promise<GetStatsRes> {
|
||||
return (await fetch(`${baseUrl}/api/offers/get-stats`).then((res) =>
|
||||
res.json(),
|
||||
)) as GetStatsRes;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue