fix: fix fetching pair id in find-pair page

This commit is contained in:
Andrew Besedin 2026-01-09 01:04:22 +03:00
parent 8eb7ce8201
commit 972fc15bf4
2 changed files with 4 additions and 6 deletions

View file

@ -3,6 +3,8 @@ import { GetServerSideProps } from 'next';
import { findPairID } from '@/utils/methods';
import styles from '@/styles/404.module.scss';
const API_URL = process.env.NEXT_PUBLIC_API_URL;
export const getServerSideProps: GetServerSideProps = async (context) => {
const { first, second } = context.query;
@ -13,11 +15,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
}
try {
const idFound = await findPairID(
first as string,
second as string,
context.req.headers.host as string,
);
const idFound = await findPairID(first as string, second as string, API_URL);
console.log('ID found:', idFound);

View file

@ -81,7 +81,7 @@ export async function findPairID(
second: string,
host: string | undefined = undefined,
): Promise<number | undefined> {
const findPairURL = `${host ? `https://${host}` : ''}/api/dex/find-pair`;
const findPairURL = `${host ?? ''}/api/dex/find-pair`;
console.log('Find pair URL:', findPairURL);