-
-
Save uno-de-piera/b4c5bb63af887ab31253f17ed62fdd76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div>{{ posts }}</div><!-- posts con comentarios --> | |
</template> | |
<script> | |
const queryListPosts = `query ListPosts( | |
$filter: ModelPostFilterInput | |
$limit: Int | |
$nextToken: String | |
) { | |
listPosts(filter: $filter, limit: $limit, nextToken: $nextToken) { | |
items { | |
id | |
owner | |
title | |
body | |
status | |
createdAt | |
updatedAt | |
comments { | |
items { | |
id | |
owner | |
comment | |
createdAt | |
} | |
} | |
} | |
} | |
}`; | |
import { API, graphqlOperation } from "aws-amplify"; | |
export default { | |
name: "PostList", | |
async mounted() { | |
let filter = {}; | |
const { data } = await API.graphql( | |
graphqlOperation(queryListPosts, { | |
filter | |
}) | |
); | |
this.posts = data.listPosts.items; | |
}, | |
data() { | |
return { | |
posts: [] | |
}; | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment