| 3140 |
stevensc |
1 |
import { axios } from '@utils'
|
|
|
2 |
|
|
|
3 |
export const saveParadigm = async (url, paradigm) => {
|
|
|
4 |
const formData = new FormData()
|
|
|
5 |
Object.entries(paradigm).forEach(([key, value]) =>
|
|
|
6 |
formData.append(key, value)
|
|
|
7 |
)
|
|
|
8 |
const response = await axios.post(url, formData)
|
|
|
9 |
const { data, success } = response.data
|
|
|
10 |
if (!success) throw new Error('Error al guardar el propósito')
|
|
|
11 |
return data
|
|
|
12 |
}
|
|
|
13 |
|
|
|
14 |
export const editParadigm = async (url, paradigm) => {
|
|
|
15 |
const formData = new FormData()
|
|
|
16 |
Object.entries(paradigm).forEach(([key, value]) =>
|
|
|
17 |
formData.append(key, value)
|
|
|
18 |
)
|
|
|
19 |
const response = await axios.post(url, formData)
|
|
|
20 |
const { data, success } = response.data
|
|
|
21 |
if (!success) throw new Error('Error al editar el propósito')
|
|
|
22 |
return data
|
|
|
23 |
}
|