I finally managed to write a raw INSERT-query with sequelize/Apollo/ExpressJS and it returns a json like {"data":{"createActie":"[[{\"id\":1598}],1]"}}
.
I can get to [[{\"id\":1598}],1] by
await this.$apollo
.mutate({
mutation: CREATE_ACTIE_QUERY,
variables: {
// ...
}
})
.then(response => {
console.log(response.data.createActie);
})
but now i want to extract the id and i struggle to say the least (i am not a trained javascript developer, just trying to learn by reading and experimenting)
the solution was adding json.parse...
JSON.parse(response.data.createActie)[0][0].id
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.