Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15123 Rev 15129
Línea 7... Línea 7...
7
import { addNotification } from '../../../redux/notification/notification.actions'
7
import { addNotification } from '../../../redux/notification/notification.actions'
8
import { config } from '../../../shared/helpers/ckeditor_config'
8
import { config } from '../../../shared/helpers/ckeditor_config'
Línea 9... Línea 9...
9
 
9
 
Línea 10... Línea 10...
10
const EditModal = ({ closeModal, isOpen, edit_link, resetLink }) => {
10
const EditModal = ({ closeModal, isOpen, edit_link, resetLink }) => {
11
 
11
 
Línea 12... Línea 12...
12
	const { register, handleSubmit, watch, errors, setValue, clearErrors, getValues } = useForm()
12
	const { register, handleSubmit, watch, errors, setValue, clearErrors } = useForm()
13
	const dispatch = useDispatch()
13
	const dispatch = useDispatch()
14
 
14
 
Línea 61... Línea 61...
61
					msg: 'Registro actualizado'
61
					msg: 'Registro actualizado'
62
				}))
62
				}))
63
			})
63
			})
64
	}
64
	}
Línea 65... Línea 65...
65
 
65
 
66
	const getData = () => {
66
	const getData = ({ editor }) => {
67
		axios.get(edit_link)
67
		axios.get(edit_link)
68
			.then(({ data }) => {
68
			.then(({ data }) => {
69
				if (!data.success) {
69
				if (!data.success) {
70
					return dispatch(addNotification({
70
					return dispatch(addNotification({
Línea 73... Línea 73...
73
					}))
73
					}))
74
				}
74
				}
Línea 75... Línea 75...
75
 
75
 
76
				setFileUrl(data.data.file)
76
				setFileUrl(data.data.file)
77
				Object.keys(data.data).map((key) => register(key))
77
				Object.keys(data.data).map((key) => register(key))
-
 
78
				Object.entries(data.data).map(([key, value]) => {
-
 
79
					key === 'coment' && editor.setData(value)
-
 
80
					key !== 'file' && setValue(key, value)
78
				Object.entries(data.data).map(([key, value]) => key !== 'file' && setValue(key, value))
81
				})
79
				clearErrors()
82
				clearErrors()
80
			})
83
			})
Línea 81... Línea 84...
81
	}
84
	}
Línea 106... Línea 109...
106
					</div>
109
					</div>
107
					<div className='form-group'>
110
					<div className='form-group'>
108
						<label className="form-label">Comentario</label>
111
						<label className="form-label">Comentario</label>
109
						<CKEditor
112
						<CKEditor
110
							onChange={(e) => setValue('coment', e.editor.getData())}
113
							onChange={(e) => setValue('coment', e.editor.getData())}
111
							initData={getValues('coment') || ''}
114
							onInstanceReady={getData}
112
							config={config} />
115
							config={config} />
113
						{errors.coment && <p>{errors.coment.message}</p>}
116
						{errors.coment && <p>{errors.coment.message}</p>}
114
					</div>
117
					</div>
115
					<div className='form-group'>
118
					<div className='form-group'>
116
						<label className="form-label">Evaluación</label>
119
						<label className="form-label">Evaluación</label>