19 lines
416 B
TypeScript
19 lines
416 B
TypeScript
import Setting from '../setting/Setting'
|
|
import { useParams } from 'react-router-dom'
|
|
|
|
const PageGuard = () => {
|
|
const allowedPages = ["settings", "contacts"]
|
|
|
|
console.log("Allowed Pages: ", allowedPages)
|
|
|
|
const {page1} = useParams<{page1: string}>()
|
|
if (page1 && !allowedPages.includes(page1)) {
|
|
return <div>Access Denied</div>
|
|
}
|
|
|
|
return (
|
|
<Setting />
|
|
)
|
|
}
|
|
|
|
export default PageGuard |