Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 213 | Rev 215 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 213 Rev 214
Línea 33... Línea 33...
33
axios.interceptors.request.use(
33
axios.interceptors.request.use(
34
  async (config) => {
34
  async (config) => {
35
    if (['post', 'put', 'delete'].includes(config.method)) {
35
    if (['post', 'put', 'delete'].includes(config.method)) {
36
      const csrf = await axios.get('/csrf');
36
      const csrf = await axios.get('/csrf');
37
      if(csrf.data.success){
37
      if(csrf.data.success){
38
        config.headers['x-csrftoken'] = csrf.data.data
38
        config.headers['X-CSRF-TOKEN'] = csrf.data.data
39
      }
39
      }
40
      console.log('>>: csrf > ', csrf);
40
      console.log('>>: csrf > ', csrf);
41
    }
41
    }
42
    return config;
42
    return config;
43
  },
43
  },