Full-Stack Web Development with Vue.js and Node

(singke) #1
Building Authentication with passport.js Chapter 6

});
}
return true;
},
clear() {
this.$refs.form.reset();
},
},
};
</script>

Replace the contents of the script tag of Home.vue with the following code:


<script>
import axios from 'axios';

export default {
name: 'Movies',
data() {
return {
movies: [],
};
},
mounted() {
this.fetchMovies();
},
methods: {
async fetchMovies() {
return axios({
method: 'get',
url: '/movies',
})
.then((response) => {
this.movies = response.data.movies;
})
.catch(() => {
});
},
},
};
</script>
Free download pdf