Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

585 B
Raw Blame
import { Fider } from "@fider/services"

const navigator = {
  url: () => {
    return window.location.href
  },
  goHome: () => {
    window.location.href = "/"
  },
  goTo: (url: string) => {
    const isEqual = window.location.href === url || window.location.pathname === url
    if (!isEqual) {
      window.location.href = url
    }
  },
  replaceState: (path: string): void => {
    if (history.replaceState !== undefined) {
      const newURL = Fider.settings.baseURL + path
      window.history.replaceState({ path: newURL }, "", newURL)
    }
  },
}

export default navigator