mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-10 01:44:29 +01:00
fix: handle wrong image format in create-story cache
This commit is contained in:
@@ -22,39 +22,41 @@ export default function CreatePostPage() {
|
||||
{postType === 'bounty' && <title>Create Bounty</title>}
|
||||
{postType === 'question' && <title>Create Question</title>}
|
||||
</Helmet>
|
||||
<div
|
||||
className="page-container grid gap-24 grid-cols-1 lg:grid-cols-[1fr_4fr]"
|
||||
// style={{ gridTemplateColumns: "326px 1fr" }}
|
||||
>
|
||||
<div className="">
|
||||
{/* <PostTypeList selectionChanged={setPostType} /> */}
|
||||
<button className={`
|
||||
<div className="page-container">
|
||||
<div
|
||||
className="grid gap-24 grid-cols-1 lg:grid-cols-[1fr_4fr]"
|
||||
// style={{ gridTemplateColumns: "326px 1fr" }}
|
||||
>
|
||||
<div className="">
|
||||
{/* <PostTypeList selectionChanged={setPostType} /> */}
|
||||
<button className={`
|
||||
w-48 aspect-square bg-white rounded-12 border-2 border-gray-200 justify-around items-center text-gray-900 hover:bg-gray-50 active:bg-gray-100
|
||||
`}
|
||||
onClick={() => navigate(-1)}
|
||||
>
|
||||
<FiArrowLeft className={"text-body3"} />
|
||||
</button>
|
||||
</div>
|
||||
<div >
|
||||
{postType === 'story' && <>
|
||||
{/* <h2 className="text-h2 font-bolder text-gray-800 mb-32">
|
||||
onClick={() => navigate(-1)}
|
||||
>
|
||||
<FiArrowLeft className={"text-body3"} />
|
||||
</button>
|
||||
</div>
|
||||
<div >
|
||||
{postType === 'story' && <>
|
||||
{/* <h2 className="text-h2 font-bolder text-gray-800 mb-32">
|
||||
Write a Story
|
||||
</h2> */}
|
||||
<CreateStoryPage />
|
||||
</>}
|
||||
{postType === 'bounty' && <>
|
||||
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
|
||||
Write a Bounty
|
||||
</h2>
|
||||
<BountyForm />
|
||||
</>}
|
||||
{postType === 'question' && <>
|
||||
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
|
||||
Write a Question
|
||||
</h2>
|
||||
<QuestionForm />
|
||||
</>}
|
||||
<CreateStoryPage />
|
||||
</>}
|
||||
{postType === 'bounty' && <>
|
||||
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
|
||||
Write a Bounty
|
||||
</h2>
|
||||
<BountyForm />
|
||||
</>}
|
||||
{postType === 'question' && <>
|
||||
<h2 className="text-h2 font-bolder text-gray-800 mb-32">
|
||||
Write a Question
|
||||
</h2>
|
||||
<QuestionForm />
|
||||
</>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -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<IStoryFormInputs, {
|
||||
const storageService = new StorageService<CreateStoryType>('story-edit');
|
||||
|
||||
|
||||
export default function CreateStoryPage() {
|
||||
function CreateStoryPage() {
|
||||
|
||||
|
||||
const { story } = useAppSelector(state => ({
|
||||
@@ -103,3 +105,6 @@ export default function CreateStoryPage() {
|
||||
</FormProvider>
|
||||
)
|
||||
}
|
||||
|
||||
// TODO: change the default cover_image on error
|
||||
export default withErrorBoundary(CreateStoryPage, { FallbackComponent: ErrorPage, onError: () => { storageService.set({ ...storageService.get()!, cover_image: null as any }) } })
|
||||
Reference in New Issue
Block a user