Skip to content

Conversation

@barrera77
Copy link

  1. Created useCreatePost hook
  • Handles form validation.
  • Sends POST request to API.
  • Redirects after success.
  • Manages errors and loading state.
  1. Updated New Post page
  • Uses useCreatePost instead of inline submission logic.
  • Auto-generates id (UUID) and slug.
  • Formats createdDate for input.
  1. Fixed redirection after post creation
  • Redirects to post page or posts index instead of trying to read missing fields from response.
  1. Posts index page
  • Fetches posts via getStaticProps.
  • Displays posts in a list.
  • Includes “Create New Post” link to the new post page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant