diff --git a/src/features/Posts/pages/CreatePostPage/CreatePostPage.tsx b/src/features/Posts/pages/CreatePostPage/CreatePostPage.tsx index bd898ed..64eb671 100644 --- a/src/features/Posts/pages/CreatePostPage/CreatePostPage.tsx +++ b/src/features/Posts/pages/CreatePostPage/CreatePostPage.tsx @@ -22,39 +22,41 @@ export default function CreatePostPage() { {postType === 'bounty' && Create Bounty} {postType === 'question' && Create Question} -
-
- {/* */} - -
-
- {postType === 'story' && <> - {/*

+ onClick={() => navigate(-1)} + > + + +

+
+ {postType === 'story' && <> + {/*

Write a Story

*/} - - } - {postType === 'bounty' && <> -

- Write a Bounty -

- - } - {postType === 'question' && <> -

- Write a Question -

- - } + + } + {postType === 'bounty' && <> +

+ Write a Bounty +

+ + } + {postType === 'question' && <> +

+ Write a Question +

+ + } +
diff --git a/src/features/Posts/pages/CreatePostPage/CreateStoryPage/CreateStoryPage.tsx b/src/features/Posts/pages/CreatePostPage/CreateStoryPage/CreateStoryPage.tsx index d5f8b51..b48996f 100644 --- a/src/features/Posts/pages/CreatePostPage/CreateStoryPage/CreateStoryPage.tsx +++ b/src/features/Posts/pages/CreatePostPage/CreateStoryPage/CreateStoryPage.tsx @@ -1,7 +1,9 @@ import { yupResolver } from "@hookform/resolvers/yup"; import { useRef, useState } from "react"; +import { ErrorBoundary, withErrorBoundary } from "react-error-boundary"; import { FormProvider, NestedValue, Resolver, useForm } from "react-hook-form"; +import ErrorPage from "src/Components/Errors/ErrorPage/ErrorPage"; import { Post_Type } from "src/graphql"; import { StorageService } from "src/services"; import { useAppSelector } from "src/utils/hooks"; @@ -55,7 +57,7 @@ export type CreateStoryType = Override('story-edit'); -export default function CreateStoryPage() { +function CreateStoryPage() { const { story } = useAppSelector(state => ({ @@ -103,3 +105,6 @@ export default function CreateStoryPage() { ) } + +// TODO: change the default cover_image on error +export default withErrorBoundary(CreateStoryPage, { FallbackComponent: ErrorPage, onError: () => { storageService.set({ ...storageService.get()!, cover_image: null as any }) } }) \ No newline at end of file