Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
How do I get the id of the created order

I am using Strapi with Nuxt and I would like to redirect to the new order it was created after successfully posting the order to Strapi. What I'm looking for is the equivalent of mysql_insert_id() in the PHP world.

code example

try {
    const neworder = await this.$strapi.$orders.create(this.neworder)
    console.log(neworder)
    if(neworder !== null) {
        this.$router.push({ name:'order-id', params: neworder.id })
    }
} catch (error) {
    this.error = error
}

I can see the new id on the console log:

console log

How do I access the returned id and pass it to this.$router.push's params? I tried using 'id' same as it shows on the console but no luck.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I figured it out. I'm going to leave this open in case it helps someone else.

redirect ($router.push) should be like this:

this.$router.push({ name:'order-id', params: {id: neworder.id }})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda