Vue notifications array

I have some problems returning an array of notifications.
I have one simple wizard form that works good, and if it’s ok I’m returning success message with Toastification, that looks like so:

this.$toast({
                            component: ToastificationContent,
                            props: {
                                title: 'Product Added',
                                icon: 'PlusIcon',
                                variant: 'success',
                            },
                        })

And this works good. But problem is listing an array of error messages.
My backend returns errors like so:

{
    "response": false,
    "message": [
        "The sku has already been taken.",
        "The slug has already been taken."
    ]
}

So I need to catch messages and show to the client, so I tried something like this:

.catch(error => {
                        console.log(error.response.data.message)

                        error.response.data.message.map(function(value, key) {
                             this.$toast({
                                component: ToastificationContent,
                                props: {
                                    title: 'Something bad happened',
                                    text: 'here must be a message from the array. How to catch it?',
                                    icon: 'XIcon',
                                    variant: 'danger',
                                },
                        })
                        });
                    });

But every time I tried using this it says like:

TypeError: Cannot read property ‘$toast’ of undefined

Any ideas how to resolve that?

133 thoughts on “Vue notifications array”

  1. Pingback: sildenafil 50 mg
  2. Pingback: viagra price
  3. Pingback: cialis soft tabs
  4. Pingback: cialis shop
  5. Pingback: sildenafil prices
  6. Pingback: dapoxetine cialis
  7. Pingback: sildenafil 50mg
  8. Pingback: canadian viagra
  9. Pingback: lady viagra
  10. Pingback: herbal viagra
  11. Pingback: viagra in india
  12. Pingback: cialis viagra
  13. Pingback: walgreens viagra
  14. Pingback: viagra prices
  15. Pingback: comprar cialis

Leave a Comment