fix: fix fetching pair id in find-pair page
This commit is contained in:
parent
8eb7ce8201
commit
972fc15bf4
2 changed files with 4 additions and 6 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue