This commit is contained in:
Luiz Silva 2026-03-23 18:20:23 -03:00
parent a6b3b14753
commit e27bcd8e7c
14 changed files with 18 additions and 69 deletions

View file

@ -63,9 +63,7 @@ export class TipagemRotas<T extends { [q: string]: any }> {
*/
endereco(query: T, usarComoHash?: boolean) {
const win =
(typeof globalThis !== "undefined" && (globalThis as any).window) ||
undefined
const win = (typeof globalThis !== "undefined" && (globalThis as any).window) || undefined
const url = new URL(win ? win.location.href : "http://localhost")
url.pathname = this.caminho
@ -96,9 +94,7 @@ export class TipagemRotas<T extends { [q: string]: any }> {
if (this._acaoIr) {
this._acaoIr(this.endereco({ ...query }))
} else {
const win =
(typeof globalThis !== "undefined" && (globalThis as any).window) ||
undefined
const win = (typeof globalThis !== "undefined" && (globalThis as any).window) || undefined
if (win) {
win.location.href = this.endereco({ ...query })
}
@ -124,9 +120,7 @@ export class TipagemRotas<T extends { [q: string]: any }> {
// pegar hash
const hash = url.hash
if (hash) {
const hashObj = Object.fromEntries(
new URLSearchParams(hash.slice(1)).entries(),
)
const hashObj = Object.fromEntries(new URLSearchParams(hash.slice(1)).entries())
queryObj = { ...queryObj, ...hashObj } as T
}