Advertisement
Guest User

Untitled

a guest
Aug 10th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. data() {
  2.     return {
  3.       sellers: []
  4.     }
  5.   },
  6.   mounted() {
  7.     this.getAllSellers()
  8.   },
  9.   methods: {
  10.     deleteSeller: function(seller_name) {
  11.  
  12.       // removed notification
  13.       var removed_not = new Noty({
  14.         type: "success",
  15.         layout: "topRight",
  16.         text: '<i class="fas fa-check"></i> &nbsp; Sprzedawca ' + seller_name + " został usunięty z listy",
  17.         timeout: 4000,
  18.         progressBar: true,
  19.         killer: true,
  20.       })
  21.  
  22.       var sellers = this.sellers
  23.  
  24.       // confirm notification
  25.       var confirm_not = new Noty({
  26.         type: "info",
  27.         layout: "topCenter",
  28.         text: 'Usunąć ' + seller_name + " z listy sprzedawców?",
  29.         closeWith: ["button"],
  30.         killer: true,
  31.         buttons: [
  32.           Noty.button('Anuluj', 'button modal-edit-button', function () {
  33.               confirm_not.close()
  34.           }),
  35.           Noty.button('Zatwierdź', 'button modal-confirm-button', function () {
  36.             Vue.http.delete("http://192.168.1.148:8000/api/seller/" + seller_name)
  37.               .then((res) => {
  38.                 var seller_index = sellers.indexOf(seller_name)
  39.                 if (seller_index > -1) {
  40.                   sellers.splice(seller_index, 1)
  41.                 }
  42.                 this.sellers = sellers            <--------------------- NIE DZIAŁA, A FAJNIE BYŁOBY GDYBY DZIAŁAŁO
  43.                 removed_not.show()
  44.               })
  45.               .catch((err) => {
  46.                 // error notification
  47.                 var error_not = new Noty({
  48.                   type: "error",
  49.                   layout: "topRight",
  50.                   text: '<i class="fas fa-exclamation"></i> &nbsp; Nie udało się usunąć sprzedawcy',
  51.                   timeout: 4000,
  52.                   progressBar: true,
  53.                   killer: true,
  54.                 })
  55.                 error_not.show()
  56.                 console.log(err)
  57.               })
  58.           }, {id: 'button1', 'data-status': 'ok'})
  59.         ]
  60.       });
  61.       confirm_not.show()
  62.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement