Problème avec vuejs et babel-polyfill

Par djtec, il y a 7 ans


Bonjour,

Voilà j'ai un problème en suivant le tutoriel de module de commentaire avec vuejs car j'obtiens le message suivant au moment ou j'essaye de supprimer un commentaire: Unhandled promise rejection TypeError: "state._comments.findIndex is not a function"

Voici une partie de mon code:

Ma mutation

deleteComment: async function (state, comment) { if (comment.reply !== 0) { let parent = state._comments.find(c => c.id === comment.reply) console.log(parent) //let index = state._comments.findIndex(c => c.id === comment.id) //parent.replies.splice(index, 1) } else { let index = state._comments.findIndex(c => c.id === comment.id) //state._comments.splice(index, 1) } //let comments = await fetchApi('/api/comments/delete' + comment.id) }

Et au debut du fichier j'ai bien import 'babel-polyfill'

Quelqu'un aurait-il une idée du problème car là je bloque total

Merci d'avance

1 réponse

djtec, il y a 7 ans

En faites c'est un problème résolu car c'était laravel qui me renvoyait par json un objet et non un array