3๐
โ
I suppose that response
is an object that contains the property data
(see docs) which (in this case) holds an array of objects.
Assuming you want to save postId, email and name for every comment in items
, you could try this:
const response = await axios.get('https://jsonplaceholder.typicode.com/posts/1/comments');
this.items = response.data.map(comment => ({
postId: comment.postId,
email: comment.email,
name: comment.name,
}));
๐คsandrooco
Source:stackexchange.com