Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Allow a more generic slug handling

Joshen Lim2a4926641fe1
diff --git a/studio/pages/project/_/[[...routeSlug]].tsx b/studio/pages/project/_/[[...routeSlug]].tsx
index b920e601499..d8b15b31d03 100644
--- a/studio/pages/project/_/[[...routeSlug]].tsx
+++ b/studio/pages/project/_/[[...routeSlug]].tsx
@@ -7,7 +7,7 @@ import { observer } from 'mobx-react-lite'
import { withAuth } from 'hooks'
import BaseLayout from 'components/layouts'
import ProjectList from 'components/interfaces/Home/ProjectList'
-import { Typography, IconChevronRight } from '@supabase/ui'
+import { Typography } from '@supabase/ui'
interface Props {}
@@ -30,6 +30,10 @@ const Header: FC<Props> = () => {
)
}
+// [Joshen] I'd say we don't do route validation here, this page will act more
+// like a proxy to the project specific pages, and we let those pages handle
+// any route validation logic instead
+
const GenericProjectPage: NextPage = () => {
const router = useRouter()
const { routeSlug } = router.query
@@ -37,19 +41,10 @@ const GenericProjectPage: NextPage = () => {
const urlRewriterFactory = (slug: string | string[] | undefined) => {
return (projectRef: string) => {
if (!Array.isArray(slug)) {
- return `/project/${projectRef}/settings/general`
- }
-
- if (slug[0] === 'auth') {
- if (slug[1]) return `/project/${projectRef}/auth/${slug[1]}`
- return `/project/${projectRef}/auth/settings`
+ return `/project/${projectRef}`
}
- let slugPath = ''
- slug.forEach((s) => {
- slugPath += `${s}/`
- })
-
+ const slugPath = slug.reduce((a: string, b: string) => `${a}/${b}`, '').slice(1)
return `/project/${projectRef}/${slugPath}`
}
}