mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
16 lines
565 B
TypeScript
16 lines
565 B
TypeScript
import * as Sentry from '@sentry/nextjs';
|
|
import type { NextApiRequest } from 'next';
|
|
|
|
import * as cookies from 'lib/cookies';
|
|
|
|
export default function getUrlWithNetwork(_req: NextApiRequest, path: string) {
|
|
const networkType = _req.cookies[cookies.NAMES.NETWORK_TYPE];
|
|
const networkSubType = _req.cookies[cookies.NAMES.NETWORK_SUB_TYPE];
|
|
|
|
if (!networkType) {
|
|
Sentry.captureException(new Error('Incorrect network'), { extra: { networkType, networkSubType } });
|
|
}
|
|
|
|
return `/${ networkType }${ networkSubType ? '/' + networkSubType : '' }/${ path }`;
|
|
}
|