How it works...

In the mounted hook, we are installing a so called interceptor. In particular, it is a request interceptor, which means it will take our request and manipulate it before sending it out to the Internet:

axios.interceptors.request.use(config => {   const body =, '***') = body   return config })

The config object contains a lot of things we can edit. It contains the headers and URL parameters. It also contains Axios configuration variables. You can check out the Axios documentation for an up-to-date list.

We are taking what's inside the data part that got sent along with the POST request and sniffing if the punk word is found. If that is the case, it will get substituted with ...

Get Vue.js 2 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.