Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- import db from '../firebaseInit'
- export default {
- name: 'search-result',
- props: {
- resultID: {
- type: String,
- required: true,
- },
- },
- data () {
- return {
- id : this.resultID,
- data: {
- id: '',
- movies: {
- poster: '',
- name: '',
- director: '',
- stars: '',
- genre: '',
- metascore: null
- }
- }
- }
- },
- methods: {
- getData(data) {
- const movieRefs = db.collection('movies').doc(this.id)
- const searchResult = movieRefs.get()
- .then(doc => {
- const data = {
- movies: doc.data(),
- id: this.id
- }
- return this.data = data
- })
- .catch(function(error) {
- console.log("Error getting document:", error);
- });
- },
- },
- mounted() {
- this.getData();
- }
- }
- </script>
Add Comment
Please, Sign In to add comment