Skip to content

Commit 35ddcab

Browse files
committed
Hook up cancel button
1 parent 270f55c commit 35ddcab

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

site/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export interface Project {
3939
active_version_id: string
4040
}
4141

42-
>>>>>>> main
4342
export const login = async (email: string, password: string): Promise<LoginResponse> => {
4443
const response = await fetch("/api/v2/login", {
4544
method: "POST",

site/components/Form/FormDropdownField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ const useStyles = makeStyles({
5252
hintText: {
5353
opacity: 0.75,
5454
},
55-
})
55+
})

site/pages/projects/create.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react"
22
import { makeStyles } from "@material-ui/core/styles"
3+
import { useRouter } from "next/router"
34
import useSWR from "swr"
45

56
import { provisioners } from "../../api"
@@ -8,6 +9,7 @@ import { FullScreenLoader } from "../../components/Loader/FullScreenLoader"
89
import { CreateProjectForm } from "../../forms/CreateProjectForm"
910

1011
const CreateProjectPage: React.FC = () => {
12+
const router = useRouter()
1113
const styles = useStyles()
1214
const { me } = useUser(true)
1315
const { data: organizations, error } = useSWR("/api/v2/users/me/organizations")
@@ -21,13 +23,17 @@ const CreateProjectPage: React.FC = () => {
2123
return <FullScreenLoader />
2224
}
2325

26+
const onCancel = async () => {
27+
await router.push("/projects")
28+
}
29+
2430
return (
2531
<div className={styles.root}>
2632
<CreateProjectForm
2733
provisioners={provisioners}
2834
organizations={organizations}
2935
onSubmit={(request) => alert(JSON.stringify(request))}
30-
onCancel={() => alert("Cancelled")}
36+
onCancel={onCancel}
3137
/>
3238
</div>
3339
)

0 commit comments

Comments
 (0)