fix: failed to retrieve postgres version in setting (#20556)

* chore: make a fake api to avoid showing error page

* chore: use redirect to limit access to setting page

* chore: revert change
This commit is contained in:
Austin Tran authored and GitHub committed 2024-03-14 14:07:35 +00:00
1 parent 2f4cb194ed
commit 48eee8fa58
1 file changed
+8 -1
@@ -1,11 +1,12 @@
import { useIsFeatureEnabled, useSelectedOrganization, useSelectedProject, withAuth } from 'hooks'
import { useRouter } from 'next/router'
import { PropsWithChildren } from 'react'
import { PropsWithChildren, useEffect } from 'react'
import { generateSettingsMenu } from './SettingsMenu.utils'
import { useParams } from 'common'
import { ProductMenu } from 'components/ui/ProductMenu'
import { ProjectLayout } from '..'
import { IS_PLATFORM } from 'lib/constants'
interface SettingsLayoutProps {
title?: string
@@ -17,6 +18,12 @@ const SettingsLayout = ({ title, children }: PropsWithChildren<SettingsLayoutPro
const project = useSelectedProject()
const organization = useSelectedOrganization()
useEffect(() => {
if (!IS_PLATFORM) {
router.push('/project/default')
}
}, [router])
// billing pages live under /billing/invoices and /billing/subscription, etc
// so we need to pass the [5]th part of the url to the menu
const page = router.pathname.includes('billing')