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.
This commit is contained in:
Joe Previte
2022-09-20 20:27:52 +00:00
parent 09b3d7e4ad
commit bad7ffb677
+8 -1
View File
@@ -1,6 +1,13 @@
import { FC } from "react"
import { Navigate } from "react-router-dom"
import { Navigate, useSearchParams } from "react-router-dom"
export const IndexPage: FC = () => {
const [searchParams, _] = useSearchParams()
const template = searchParams.get("template")
if (template) {
return <Navigate to={`/templates/${template}`} replace />
}
return <Navigate to="/workspaces" replace />
}