Fix BlogEdit.tsx import and component issues

- Fix import path from @/api/blog-api to @/lib/api/blog-api
- Replace TagManager component with simple tag input since BlogEdit uses plain state
- Remove unused handleTagsChange function
- This resolves the build error where blog-api file was not found
This commit is contained in:
Damir Mukimov 2025-11-27 06:39:24 +01:00
parent a3ffebdf0c
commit 1656b67abe
No known key found for this signature in database
GPG Key ID: 42996CC7C73BC750

View File

@ -1,7 +1,6 @@
import { getBlogPost, updateBlogPost } from "@/lib/api/blog-api";
import { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import { getBlogPost, updateBlogPost } from "@/api/blog-api";
import { TagManager } from "../../components/blog/tag-manager";
interface BlogPost {
id: string;
@ -38,11 +37,6 @@ const BlogEdit: React.FC = () => {
setPost({ ...post, [e.target.name]: e.target.value });
};
const handleTagsChange = (tags: string[]) => {
if (!post) return;
setPost({ ...post, tags });
};
const handleStatusChange = (status: BlogPost["status"]) => {
if (!post) return;
setPost({ ...post, status });
@ -85,7 +79,20 @@ const BlogEdit: React.FC = () => {
className="textarea textarea-bordered w-full h-40"
required
/>
<TagManager tags={post.tags} onChange={handleTagsChange} />
<div>
<label className="block text-sm font-medium mb-2">Tags</label>
<input
type="text"
value={post.tags.join(", ")}
onChange={(e) => {
const tags = e.target.value.split(",").map(tag => tag.trim()).filter(tag => tag);
setPost({ ...post, tags });
}}
placeholder="Enter tags separated by commas"
className="input input-bordered w-full"
/>
<p className="text-xs text-gray-500 mt-1">Separate tags with commas</p>
</div>
<div className="flex gap-2 items-center">
<label htmlFor="status">Status:</label>
<select