Skip to content

Commit

Permalink
chore: autonav
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Jul 30, 2024
1 parent 57d1f2f commit 1fcb820
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { UseDisclosureReturn } from "@chakra-ui/react"
import type { IsomerSchema } from "@opengovsg/isomer-components"
import type { PropsWithChildren } from "react"
import { createContext, useContext, useMemo, useState } from "react"
import { useRouter } from "next/router"
import { merge } from "lodash"

import articleLayoutPreview from "~/features/editing-experience/data/articleLayoutPreview.json"
Expand Down Expand Up @@ -76,6 +77,7 @@ const useCreatePageWizardContext = ({
}, [layout, title])

const utils = trpc.useUtils()
const router = useRouter()

const { mutate, isLoading } = trpc.page.createPage.useMutation({
onSuccess: async () => {
Expand All @@ -86,11 +88,18 @@ const useCreatePageWizardContext = ({
})

const handleCreatePage = formMethods.handleSubmit((values) => {
mutate({
siteId,
folderId,
...values,
})
mutate(
{
siteId,
folderId,
...values,
},
{
onSuccess: ({ pageId }) => {
router.push(`/sites/${siteId}/pages/${pageId}`)

Check failure on line 99 in apps/studio/src/features/editing-experience/components/CreatePageModal/CreatePageWizardContext.tsx

View workflow job for this annotation

GitHub Actions / lint

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
},
},
)
})

const handleNextToDetailScreen = () => {
Expand Down

0 comments on commit 1fcb820

Please sign in to comment.