fix: resolve variable declaration order, modal state and lint errors
Deploy Canina / deploy (push) Successful in 41s
Deploy Canina / deploy (push) Successful in 41s
This commit is contained in:
1 parent
fc324aacaf
commit
b2b80849ea
11 files changed
+353
-302
No files matched your search
@@ -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 (
|
||||
|
||||
Reference in new issue
Block a user