API Calls
- Fetch paginated blogs:
fetchPaginatedBlogs - Fetch total blog count:
fetchTotalBlogs - Search blogs:
searchBlogs - Search blogs count:
searchBlogsCount - Delete a blog:
handleDelete
API Documentation
1. Get Paginated Blogs
Endpoint:/blog/latest-blogs
Method: POST
Description: Retrieves a paginated list of blogs.
Request Body:
2. Get Total Blog Count
Endpoint:/blog/all-latest-blogs-count
Method: POST
Description: Retrieves the total count of blogs.
Response:
3. Search Blogs
Endpoint:/blog/search
Method: POST
Description: Searches blogs by title or description.
Request Body:
4. Delete a Blog
Endpoint:/blog/delete
Method: POST
Description: Deletes a blog by its blog_id.
Request Body:
5. Get Blog Details
Endpoint:/blog/details
Method: POST
Description: Retrieves details of a single blog.
Request Body:
Usage Flow
- The admin accesses the Blogs Management page.
- The component fetches paginated blog data from
/blog/latest-blogs. - The admin can search for blogs by entering a query.
- The admin can delete a blog by clicking the delete button, triggering a request to
/blog/delete. - A toast notification confirms success or failure of deletion.
Error Handling
- Invalid blog ID: Returns
404 Not Found - Unauthorized request: Returns
403 Forbidden - Server errors: Returns
500 Internal Server Error

