File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -25,4 +25,8 @@ export namespace Project {
25
25
26
26
return Promise . resolve ( [ project1 , project2 ] )
27
27
}
28
+
29
+ export const createProject = ( name : string ) : Promise < string > => {
30
+ return Promise . resolve ( "test-workspace" )
31
+ }
28
32
}
Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
import { useRouter } from "next/router"
3
+ import { useFormik } from "formik"
4
+
5
+ import * as API from "../../../api"
3
6
4
7
import { FormPage , FormButton } from "../../../components/PageTemplates"
5
8
6
9
const CreateProjectPage : React . FC = ( ) => {
7
10
const router = useRouter ( )
8
11
const { projectId } = router . query
9
12
13
+
14
+ const form = useFormik ( {
15
+ initialValues : {
16
+ name : ""
17
+ } ,
18
+ onSubmit : async ( { name } ) => {
19
+ return API . Project . createProject ( name )
20
+ } ,
21
+ } )
22
+
10
23
const cancel = ( ) => {
11
24
router . back ( )
12
25
}
13
26
14
- const submit = ( ) => {
15
- alert ( "Submitting workspace" )
27
+ const submit = async ( ) => {
28
+ const workspaceId = await form . submitForm ( )
29
+ router . push ( `/workspaces/${ workspaceId } ` )
16
30
}
17
31
18
32
const buttons : FormButton [ ] = [
You can’t perform that action at this time.
0 commit comments