Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3040 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3040 Rev 3719
Línea 1... Línea 1...
1
import { axios } from '@utils'
1
import { axios } from '@utils';
2
 
2
 
3
export const addEducation = async (uuid, experience) => {
3
export const addEducation = async (uuid, experience) => {
4
  const url = `/profile/my-profiles/experience/${uuid}/operation/add`
4
  const url = `/profile/my-profiles/experience/${uuid}/operation/add`;
5
 
5
 
6
  const formData = new FormData()
6
  const formData = new FormData();
7
  Object.entries(experience).forEach(([key, value]) =>
7
  Object.entries(experience).forEach(([key, value]) => formData.append(key, value));
8
    formData.append(key, value)
-
 
9
  )
-
 
10
 
8
 
11
  const response = await axios.post(url, formData)
9
  const response = await axios.post(url, formData);
12
 
10
 
13
  const { data, success } = response.data
11
  const { data, success } = response.data;
14
  if (!success) throw new Error('Failed to add experience')
12
  if (!success) throw new Error('Failed to add experience');
15
 
13
 
16
  return data
14
  return data;
17
}
15
};
18
 
16
 
19
export const editEducation = async (url, experience) => {
17
export const editEducation = async (url, experience) => {
20
  const formData = new FormData()
18
  const formData = new FormData();
21
  Object.entries(experience).forEach(([key, value]) =>
19
  Object.entries(experience).forEach(([key, value]) => formData.append(key, value));
22
    formData.append(key, value)
-
 
23
  )
-
 
24
 
20
 
25
  const response = await axios.post(url, formData)
21
  const response = await axios.post(url, formData);
26
 
22
 
27
  const { data, success } = response.data
23
  const { data, success } = response.data;
28
  if (!success) throw new Error('Failed to edit experience')
24
  if (!success) throw new Error('Failed to edit experience');
29
 
25
 
30
  return data
26
  return data;
31
}
27
};
32
 
28
 
33
export const deleteEducation = async (url) => {
29
export const deleteEducation = async (url) => {
34
  const response = await axios.post(url)
30
  const response = await axios.post(url);
35
 
31
 
36
  const { data, success } = response.data
32
  const { data, success } = response.data;
37
  if (!success) throw new Error('Failed to edit experience')
33
  if (!success) throw new Error('Failed to edit experience');
38
 
34
 
39
  return data
35
  return data;
40
}
36
};