♻️ Remove unused and update utils (#1786)

This commit is contained in:
Luke Vella 2025-06-23 11:07:26 +01:00 committed by GitHub
parent 7ab25c68de
commit 40d6a51245
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 67 deletions

View file

@ -15,7 +15,10 @@ function joinPath(baseUrl: string, subpath = "") {
return baseUrl;
}
export function absoluteUrl(subpath = "", query: Record<string, string> = {}) {
export function absoluteUrl(
subpath = "",
query: { [key: string]: string | undefined } = {},
) {
const baseUrl =
process.env.NEXT_PUBLIC_BASE_URL ??
getVercelUrl() ??
@ -23,10 +26,11 @@ export function absoluteUrl(subpath = "", query: Record<string, string> = {}) {
const url = new URL(subpath, baseUrl);
// biome-ignore lint/complexity/noForEach: Fix this later
Object.entries(query).forEach(([key, value]) => {
url.searchParams.set(key, value);
});
for (const [key, value] of Object.entries(query)) {
if (value) {
url.searchParams.set(key, value);
}
}
const urlString = url.href;