Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1080 Rev 3651
Línea 24... Línea 24...
24
}
24
}
Línea 25... Línea 25...
25
 
25
 
26
axios.all = Axios.all;
26
axios.all = Axios.all;
27
axios.spread = Axios.spread;
27
axios.spread = Axios.spread;
28
axios.upload = (url, data) => {
28
axios.upload = (url, data) => {
29
  return axios.post(url, createFormData(data), {
29
  return axios.post(url, new FormData(data), {
30
    headers: {
30
    headers: {
31
      'Content-Type': 'multipart/form-data'
31
      'Content-Type': 'multipart/form-data'
32
    }
32
    }
33
  });
33
  });
Línea 38... Línea 38...
38
    if (['post', 'put', 'delete'].includes(request.method)) {
38
    if (['post', 'put', 'delete'].includes(request.method)) {
39
      try {
39
      try {
40
        const resp = await axios.get('/csrf')
40
        const resp = await axios.get('/csrf')
41
        if (resp.data.success) {
41
        if (resp.data.success) {
42
          request.headers['X-CSRF-TOKEN'] = resp.data.data
42
          request.headers['X-CSRF-TOKEN'] = resp.data.data
43
          
43
 
44
          return request;
44
          return request;
45
        }
45
        }
46
      }
46
      }
47
      catch (err) {
47
      catch (err) {
48
        throw new Error(`Axios problem with request during pre-flight phase: ${err}.`);
48
        throw new Error(`Axios problem with request during pre-flight phase: ${err}.`);