preserve image
This commit is contained in:
parent
8c80e0f38e
commit
8f0b8c48a9
|
|
@ -1,6 +1,7 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { uploadFile } from "@/shared/lib/uploadFile";
|
import { uploadFile } from "@/shared/lib/uploadFile";
|
||||||
import type { CommentAction } from "@/entities/action/schema";
|
import type { CommentAction } from "@/entities/action/schema";
|
||||||
|
import { getActionAttachmentType } from "@/entities/action/lib";
|
||||||
|
|
||||||
import Tabs from "@mui/material/Tabs";
|
import Tabs from "@mui/material/Tabs";
|
||||||
import Tab from "@mui/material/Tab";
|
import Tab from "@mui/material/Tab";
|
||||||
|
|
@ -60,7 +61,13 @@ export default function ActionEditor({
|
||||||
const [value, setValue] = useState(0);
|
const [value, setValue] = useState(0);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
const [imageUrl, setImageUrl] = useState<string | null>(null);
|
const attachmentType = initialAction
|
||||||
|
? getActionAttachmentType(initialAction)
|
||||||
|
: "empty";
|
||||||
|
|
||||||
|
const [imageUrl, setImageUrl] = useState<string | null>(
|
||||||
|
attachmentType === "image" ? initialAction?.fileUrls[0]! : null,
|
||||||
|
);
|
||||||
|
|
||||||
const [action, setAction] = useState<CommentAction>(
|
const [action, setAction] = useState<CommentAction>(
|
||||||
initialAction ?? {
|
initialAction ?? {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user