1
1
import { useDashboard } from "modules/dashboard/useDashboard" ;
2
- import type { FC } from "react" ;
2
+ import { createContext , type FC } from "react" ;
3
3
import CreateWorkspacePage from "./CreateWorkspacePage" ;
4
4
import CreateWorkspacePageExperimental from "./CreateWorkspacePageExperimental" ;
5
+ import { useParams } from "react-router-dom" ;
6
+ import { useQuery } from "react-query" ;
7
+ import { templateByName } from "api/queries/templates" ;
5
8
6
9
const CreateWorkspaceExperimentRouter : FC = ( ) => {
7
10
const { experiments } = useDashboard ( ) ;
8
-
9
11
const dynamicParametersEnabled = experiments . includes ( "dynamic-parameters" ) ;
10
12
13
+ const { organization : organizationName = "default" , template : templateName } =
14
+ useParams ( ) as { organization ?: string ; template : string } ;
15
+ const templateQuery = useQuery (
16
+ templateByName ( organizationName , templateName ) ,
17
+ ) ;
18
+
19
+ const something = JSON . parse (
20
+ localStorage . getItem ( `parameters.${ templateQuery . data ?. id } .optOut` ) ?? "" ,
21
+ ) ;
22
+
11
23
if ( dynamicParametersEnabled ) {
12
24
return < CreateWorkspacePageExperimental /> ;
13
25
}
@@ -16,3 +28,5 @@ const CreateWorkspaceExperimentRouter: FC = () => {
16
28
} ;
17
29
18
30
export default CreateWorkspaceExperimentRouter ;
31
+
32
+ const CreateWorkspaceProvider = createContext ( undefined ) ;
0 commit comments