mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move all RouteParam's and URL builders to src/common (#2778)
- Prevents some circular dependencies - Allowed main to use them as needed Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
540c6dac37
commit
5ee2ab5b4a
134 files changed
+462
-515
No files matched your search
@@ -21,7 +21,7 @@
|
||||
|
||||
import { compile } from "path-to-regexp";
|
||||
|
||||
export interface IURLParams<P extends object = {}, Q extends object = {}> {
|
||||
export interface URLParams<P extends object = {}, Q extends object = {}> {
|
||||
params?: P;
|
||||
query?: Q;
|
||||
fragment?: string;
|
||||
@@ -30,7 +30,7 @@ export interface IURLParams<P extends object = {}, Q extends object = {}> {
|
||||
export function buildURL<P extends object = {}, Q extends object = {}>(path: string | any) {
|
||||
const pathBuilder = compile(String(path));
|
||||
|
||||
return function ({ params, query, fragment }: IURLParams<P, Q> = {}): string {
|
||||
return function ({ params, query, fragment }: URLParams<P, Q> = {}): string {
|
||||
const queryParams = query ? new URLSearchParams(Object.entries(query)).toString() : "";
|
||||
const parts = [
|
||||
pathBuilder(params),
|
||||
|
||||
Reference in new issue
Block a user