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