Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app= new Vue({
- el : "#app",
- data : {
- books: null
- },
- methods: {
- loadImage: function(image){
- return 'storage/'+image
- },
- updateData : function(data){
- edit.name = data.name;
- edit.cover = data.cover;
- edit.price = data.price;
- edit.id = data.id;
- },
- loadData: async function(){
- try {
- const response = await axios.get('/books');
- this.books = response.data;
- } catch (error) {
- console.error(error);
- }
- },
- deleteData: function(id){
- axios.post('/book-delete', {
- id: id,
- _token : _TOKEN_
- })
- .then(function (response) {
- alert("success delete data")
- window.location.href="."
- })
- .catch(function (error) {
- console.log(error);
- });
- }
- },
- mounted() {
- this.loadData();
- },
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement