Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 6x | import { defaultStringifySearch, interpolatePath } from "@tanstack/router-core";
import type { NavigationOptions, RouteTo } from "~app/utils/navigation";
export const buildUrl = <K extends RouteTo>({
to,
params = {},
search,
}: NavigationOptions<K>) => {
const { interpolatedPath, isMissingParams } = interpolatePath({
path: to,
params: params === true ? {} : params,
});
if (isMissingParams) {
throw new Error(`Missing path params for ${to}`);
}
return `${interpolatedPath}${defaultStringifySearch(search ?? {})}`;
};
|