mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-12 13:48:35 +02:00
19 lines
397 B
TypeScript
19 lines
397 B
TypeScript
import { Request } from 'express';
|
|
|
|
export function nextLink(
|
|
req: Pick<Request, 'baseUrl' | 'path' | 'query'>,
|
|
cursor?: string,
|
|
): string {
|
|
if (!cursor) {
|
|
return '';
|
|
}
|
|
|
|
const url = `${req.baseUrl}${req.path}?`;
|
|
|
|
const params = new URLSearchParams(req.query as Record<string, string>);
|
|
|
|
params.set('cursor', cursor);
|
|
|
|
return `${url}${params.toString()}`;
|
|
}
|