fix: edit function of markdown

This commit is contained in:
h z
2024-12-07 12:03:23 +00:00
parent 7eaf37223c
commit a31cec7ef0
6 changed files with 82 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ import { fetch_ } from "../../utils/requestUtils";
const PathNode = ({ path, isRoot = false, onDelete, onSave }) => {
const [children, setChildren] = useState([]);
const [markdowns, setMarkdowns] = useState([]);
const [isExpanded, setIsExpanded] = useState(isRoot); // Root is always expanded
const [isExpanded, setIsExpanded] = useState(isRoot);
const [loading, setLoading] = useState(false);
const [isEditing, setIsEditing] = useState(false);
const [newName, setNewName] = useState(path.name);
@@ -18,13 +18,9 @@ const PathNode = ({ path, isRoot = false, onDelete, onSave }) => {
fetch_(`${config.BACKEND_HOST}/api/markdown/get_index/${path.id}`, {}, {
use_cache: true,
use_token: false
}).then((data) => {
setIndexMarkdownId(data.id);
})
.catch((error) => {
setIndexMarkdownId(null);
console.error(error);
});
.then((data) => setIndexMarkdownId(data.id))
.catch((error) => setIndexMarkdownId(null) );
}, [path]);
const handleSave = () => {