{"version":3,"file":"axios_provider-13dc4f93-chunk.js","sources":["../../../../app/javascript/helpers/axios_provider.js"],"sourcesContent":["import axios from 'axios';\r\nimport Swal from 'sweetalert2'\r\n\r\naxios.interceptors.response.use((response) => {\r\n // Handle the response here\r\n return response\r\n}, (error) => {\r\n // Handle errors here\r\n if(error?.response?.data?.data == 'Not authorized'){\r\n // TODO - MAKE THE ALERT WORKS\r\n // Swal.fire({\r\n // icon: 'error',\r\n // title: 'Tu sesiĆ³n se ha caducado',\r\n // showConfirmButton: true\r\n // });\r\n\r\n window.location.href = '/'\r\n }\r\n return Promise.reject(error)\r\n})\r\n\r\nexport const generateAxiosInstance = (baseUrl = null) => {\r\n axios.defaults.headers.common['x-api-key'] = '9c6334a7-8215-46ff-8ec9-f442cdc43cac';\r\n axios.defaults.headers.common['Accept'] = 'application/json';\r\n axios.defaults.headers.common['Content-Type'] = 'application/json';\r\n axios.defaults.baseURL = baseUrl;\r\n return axios;\r\n};"],"names":["axios","response","error","_b","_a","generateAxiosInstance","baseUrl"],"mappings":"0CAGAA,EAAM,aAAa,SAAS,IAAKC,GAEtBA,EACPC,GAAU,SAEV,QAAGC,GAAAC,EAAAF,GAAA,YAAAA,EAAO,WAAP,YAAAE,EAAiB,OAAjB,YAAAD,EAAuB,OAAQ,mBAQ9B,OAAO,SAAS,KAAO,KAEpB,QAAQ,OAAOD,CAAK,CAC/B,CAAC,EAEW,MAACG,EAAwB,CAACC,EAAU,QAC5CN,EAAM,SAAS,QAAQ,OAAO,WAAW,EAAI,uCAC7CA,EAAM,SAAS,QAAQ,OAAO,OAAY,mBAC1CA,EAAM,SAAS,QAAQ,OAAO,cAAc,EAAI,mBAChDA,EAAM,SAAS,QAAUM,EAClBN"}