mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
11 lines
361 B
TypeScript
11 lines
361 B
TypeScript
import type { NextApiRequest } from 'next';
|
|
|
|
export default function getSearchParams(req: NextApiRequest) {
|
|
const searchParams: Record<string, string> = {};
|
|
Object.entries(req.query).forEach(([ key, value ]) => {
|
|
searchParams[key] = Array.isArray(value) ? value.join(',') : (value || '');
|
|
});
|
|
|
|
return new URLSearchParams(searchParams).toString();
|
|
}
|