18 lines
450 B
TypeScript
18 lines
450 B
TypeScript
"use client"
|
|
import { useParams } from "next/navigation"
|
|
import { useEffect, useState } from "react"
|
|
|
|
export default function useSetMapView() {
|
|
const [mapUrl, setMapUrl] = useState<string | null>(null)
|
|
const params = useParams()
|
|
|
|
useEffect(() => {
|
|
if (typeof window === "undefined") return
|
|
const url = new URL(window.location.href)
|
|
url.searchParams.set("view", "map")
|
|
setMapUrl(url.toString())
|
|
}, [params])
|
|
|
|
return mapUrl
|
|
}
|