Merged in feat/SW-2241-country-map (pull request #2808)
Feat/SW-2241 country map Approved-by: Erik Tiekstra Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
17
packages/common/hooks/map/useSetMapView.ts
Normal file
17
packages/common/hooks/map/useSetMapView.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"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
|
||||
}
|
||||
Reference in New Issue
Block a user