mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
9
app/src/utils/add-query-to-path.ts
Normal file
9
app/src/utils/add-query-to-path.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function addQueryToPath(path: string, query: Record<string, string>) {
|
||||
const queryParams = [];
|
||||
|
||||
for (const [key, value] of Object.entries(query)) {
|
||||
queryParams.push(`${key}=${value}`);
|
||||
}
|
||||
|
||||
return path.includes('?') ? `${path}&${queryParams.join('&')}` : `${path}?${queryParams.join('&')}`;
|
||||
}
|
||||
Reference in New Issue
Block a user