Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
Funcionalidad de registro de Next.js

Estoy tratando de agregar un usuario de next.js a Strapi v4 y recibo el siguiente mensaje de error:

POST http://localhost:1337/api/auth/local/register 400 (Solicitud incorrecta)

Mi página de registro está en pages/account/register.js, que toma la entrada del usuario como nombre de usuario, correo electrónico y contraseña, y la publica usando handleSubmit. cerrar la sesión de nombre de usuario, correo electrónico y contraseña funciona perfectamente bien. Publicar en el backend es un problema aquí.

Mi código se ve a continuación:

 export default function registerPage() { const [username, setUsername] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const handleSubmit = (e) => { e.preventDefault(); console.log({ username, email, password }); axios .post('http://localhost:1337/api/auth/local/register', { username: 'Strapi user', email: 'user@strapi.io', password: 'strapiPassword', }) .then((response) => { // Handle success. console.log("Well done!"); console.log("User profile", response.data.user); console.log("User token", response.data.jwt); }) .catch((error) => { // Handle error. console.log("An error occurred:", error.response); }); }; return (...User Input Form) }

Gracias por leer.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!