Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bad7ffb

Browse files
committed
feat: support template query param in index
This adds support to navigate directly to a template from the index by using the `?template=<name>` query param.
1 parent 09b3d7e commit bad7ffb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

site/src/pages/index.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { FC } from "react"
2-
import { Navigate } from "react-router-dom"
2+
import { Navigate, useSearchParams } from "react-router-dom"
33

44
export const IndexPage: FC = () => {
5+
const [searchParams, _] = useSearchParams()
6+
const template = searchParams.get("template")
7+
8+
if (template) {
9+
return <Navigate to={`/templates/${template}`} replace />
10+
}
11+
512
return <Navigate to="/workspaces" replace />
613
}

0 commit comments

Comments
 (0)