melhorias de url
This commit is contained in:
parent
cb86027ff9
commit
3b45b82654
5 changed files with 18 additions and 6 deletions
|
|
@ -65,7 +65,7 @@ class TipagemRotas {
|
|||
for (const [key, value] of queryKeys) {
|
||||
url.searchParams.set(
|
||||
String(key),
|
||||
value === void 0 || value === null ? "" : value
|
||||
encodeURIComponent(JSON.stringify(value))
|
||||
);
|
||||
}
|
||||
url.hash = "";
|
||||
|
|
@ -105,6 +105,12 @@ class TipagemRotas {
|
|||
);
|
||||
return { ...queryObj, ...hashObj };
|
||||
}
|
||||
for (const chave in queryObj) {
|
||||
try {
|
||||
queryObj[chave] = JSON.parse(queryObj[chave]);
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
return queryObj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ declare const texto_busca: (...texto: any[]) => string;
|
|||
* parametros = {nome:"José"}
|
||||
*/
|
||||
declare class TipagemRotas<T extends {
|
||||
[q: string]: string | undefined;
|
||||
[q: string]: any;
|
||||
}> {
|
||||
_partesCaminho: string[];
|
||||
_acaoIr?: (endereco: string) => undefined;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "p-comuns",
|
||||
"version": "0.223.0",
|
||||
"version": "0.224.0",
|
||||
"description": "",
|
||||
"main": "./dist-back/index.js",
|
||||
"module": "./dist-front/index.mjs",
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* parametros = {nome:"José"}
|
||||
*/
|
||||
|
||||
export class TipagemRotas<T extends { [q: string]: string | undefined }> {
|
||||
export class TipagemRotas<T extends { [q: string]: any }> {
|
||||
_partesCaminho: string[] = []
|
||||
_acaoIr?: (endereco: string) => undefined
|
||||
rotulo: string | undefined
|
||||
|
|
@ -76,7 +76,7 @@ export class TipagemRotas<T extends { [q: string]: string | undefined }> {
|
|||
for (const [key, value] of queryKeys) {
|
||||
url.searchParams.set(
|
||||
String(key),
|
||||
value === undefined || value === null ? "" : value,
|
||||
encodeURIComponent(JSON.stringify(value)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -125,6 +125,12 @@ export class TipagemRotas<T extends { [q: string]: string | undefined }> {
|
|||
return { ...queryObj, ...hashObj } as T
|
||||
}
|
||||
|
||||
for (const chave in queryObj) {
|
||||
try {
|
||||
queryObj[chave] = JSON.parse(queryObj[chave])
|
||||
} catch {}
|
||||
}
|
||||
|
||||
return queryObj as Partial<T>
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue