This commit is contained in:
Luiz Silva 2026-02-08 20:30:35 -03:00
parent 0cbe901499
commit dbe0f66daf
51 changed files with 30 additions and 304 deletions

View file

@ -56,9 +56,8 @@ class TipagemRotas {
** "http://localhost:3000/caminho?q=query"
*/
endereco(query, usarComoHash) {
const url = new URL(
typeof window !== "undefined" ? window.location.href : "http://localhost"
);
const win = typeof globalThis !== "undefined" && globalThis.window || void 0;
const url = new URL(win ? win.location.href : "http://localhost");
url.pathname = this.caminho;
url.search = "";
const queryKeys = Object.entries(query);
@ -80,8 +79,9 @@ class TipagemRotas {
if (this._acaoIr) {
this._acaoIr(this.endereco({ ...query }));
} else {
if (typeof window != "undefined") {
window.location.href = this.endereco({ ...query });
const win = typeof globalThis !== "undefined" && globalThis.window || void 0;
if (win) {
win.location.href = this.endereco({ ...query });
}
}
}
@ -91,7 +91,7 @@ class TipagemRotas {
*/
parametros(urlEntrada) {
const url = urlEntrada ? new URL(urlEntrada) : new URL(
typeof window !== "undefined" ? window.location.href : "http://localhost"
typeof globalThis !== "undefined" && globalThis.window ? globalThis.window.location.href : "http://localhost"
);
const query = url.searchParams;
let queryObj = Object.fromEntries(query.entries());