Skip to content

Commit fc5c9ea

Browse files
committed
fix: example
1 parent dd2dc51 commit fc5c9ea

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import env from "codeforlife/env"
1+
import env from "codeforlife/settings"
22

3-
export * from "codeforlife/env"
3+
export * from "codeforlife/settings"
44

55
// Example of how to get an environment variable.
66
export const EXAMPLE = env.VITE_EXAMPLE ?? "DEFAULT_VALUE"

src/pages/fruitDetail/FruitDetail.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as yup from "yup"
44
import { Stack, Typography } from "@mui/material"
55
import { type FC } from "react"
66
import { Link } from "codeforlife/components/router"
7-
import { handleQueryState } from "codeforlife/utils/api"
7+
import { handleResultState } from "codeforlife/utils/api"
88
import { submitForm } from "codeforlife/utils/form"
99
import { useParamsRequired } from "codeforlife/hooks"
1010

@@ -18,24 +18,24 @@ import { paths } from "../../routes"
1818
export interface FruitDetailProps {}
1919

2020
const FruitDetail: FC<FruitDetailProps> = () => {
21-
const [updateFruit] = useUpdateFruitMutation()
2221
const [retrieveFruit, retrieveFruitResult] = useLazyRetrieveFruitQuery()
2322

2423
return useParamsRequired({
2524
shape: { id: yup.number().required().min(1) },
2625
children: () =>
27-
handleQueryState(retrieveFruitResult, fruit => (
26+
handleResultState(retrieveFruitResult, fruit => (
2827
<pages.Page>
2928
<pages.Section>
3029
<Typography variant="h1">Update fruit</Typography>
3130
<forms.Form
3231
initialValues={fruit}
33-
onSubmit={submitForm(updateFruit, {
32+
useMutation={useUpdateFruitMutation}
33+
submitOptions={{
3434
exclude: ["expires_on"],
3535
then: () => {
3636
alert("successfully updated fruit")
3737
},
38-
})}
38+
}}
3939
>
4040
<Stack>
4141
<FruitNameField />

0 commit comments

Comments
 (0)