import { writable } from "svelte/store"
import { baseURL } from "./config"

const initLoc = {
    path: (typeof window !== "undefined" && window.location?.pathname) || "/",
    search: (typeof window !== "undefined" && window.location?.search) || "",
    hash: (typeof window !== "undefined" && window.location?.hash) || "",
    push: false,
    pop: false,
    url: `${baseURL}${(typeof window !== "undefined" && window.location?.pathname) || "/"}`,
}

export const location = writable<LocationStore>(initLoc)
