fix: resolve variable declaration order, modal state and lint errors
Deploy Canina / deploy (push) Successful in 41s

This commit is contained in:
parsa aghaei committed 2026-08-23 10:55:09 +03:30
1 parent fc324aacaf
commit b2b80849ea
11 files changed
+353 -302

No files matched your search

+29 -28
View File
@@ -65,6 +65,35 @@ export default function Blogs() {
imageUrl: ''
});
const openModal = (blog: BlogPost | null = null) => {
if (blog) {
setEditingBlog(blog);
updateUrlParams({ modal: 'edit', blogId: blog.id });
setFormData({
title: blog.title,
slug: blog.slug,
content: blog.content,
isPublished: blog.isPublished,
metaTitle: blog.metaTitle || '',
metaDescription: blog.metaDescription || '',
keywords: blog.keywords || '',
imageUrl: blog.imageUrl || ''
});
} else {
setEditingBlog(null);
updateUrlParams({ modal: 'create', blogId: undefined });
setFormData({
title: '', slug: '', content: '', isPublished: true, metaTitle: '', metaDescription: '', keywords: '', imageUrl: ''
});
}
setIsModalOpen(true);
};
const closeModal = () => {
setIsModalOpen(false);
updateUrlParams({ modal: undefined, blogId: undefined });
};
const fetchBlogs = useCallback(async () => {
try {
setIsLoading(true);
@@ -129,34 +158,6 @@ export default function Blogs() {
}
};
const openModal = (blog: BlogPost | null = null) => {
if (blog) {
setEditingBlog(blog);
updateUrlParams({ modal: 'edit', blogId: blog.id });
setFormData({
title: blog.title,
slug: blog.slug,
content: blog.content,
isPublished: blog.isPublished,
metaTitle: blog.metaTitle || '',
metaDescription: blog.metaDescription || '',
keywords: blog.keywords || '',
imageUrl: blog.imageUrl || ''
});
} else {
setEditingBlog(null);
updateUrlParams({ modal: 'create', blogId: undefined });
setFormData({
title: '', slug: '', content: '', isPublished: true, metaTitle: '', metaDescription: '', keywords: '', imageUrl: ''
});
}
setIsModalOpen(true);
};
const closeModal = () => {
setIsModalOpen(false);
updateUrlParams({ modal: undefined, blogId: undefined });
};
return (