melhorias

This commit is contained in:
Luiz Silva 2024-09-15 13:58:38 -03:00
parent 7fae4d43e5
commit 97184ef169
5 changed files with 9 additions and 7 deletions

View file

@ -9,7 +9,7 @@
* parametros = {nome:"José"}
*/
export class TipagemRotas<T = { [q: string]: string | undefined }> {
export class TipagemRotas<T extends { [q: string]: string | undefined }> {
_partesCaminho: string[] = []
/** Ao criar novo obijeto de tipagem de rota é necessário passar o caminho parcial
@ -55,8 +55,9 @@ export class TipagemRotas<T = { [q: string]: string | undefined }> {
url.pathname = this.caminho
const queryKeys =
typeof query == "object" && query ? Object.entries(query) : [[query, ""]]
url.search = ""
const queryKeys = Object.entries(query)
for (const [key, value] of queryKeys) {
url.searchParams.set(String(key), value)