Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 12709 Rev 12710
Línea 2... Línea 2...
2
import React, { useState, useEffect } from 'react'
2
import React, { useState, useEffect } from 'react'
3
import axios from 'axios'
3
import axios from 'axios'
4
import parse from 'html-react-parser'
4
import parse from 'html-react-parser'
5
import { useForm } from 'react-hook-form'
5
import { useForm } from 'react-hook-form'
6
import { useDispatch } from 'react-redux'
6
import { useDispatch } from 'react-redux'
7
import { useHistory } from 'react-router-dom'
7
import { useHistory, useParams } from 'react-router-dom'
8
import { addNotification } from '../../../redux/notification/notification.actions'
8
import { addNotification } from '../../../redux/notification/notification.actions'
9
import DescriptionInput from '../../../shared/DescriptionInput'
9
import DescriptionInput from '../../../shared/DescriptionInput'
10
import SectionModal from '../components/SectionModal'
10
import SectionModal from '../components/SectionModal'
Línea 11... Línea 11...
11
 
11
 
Línea 39... Línea 39...
39
 
39
 
Línea 40... Línea 40...
40
const FormView = ({ actionLink }) => {
40
const FormView = ({ actionLink }) => {
41
 
41
 
-
 
42
	// Hooks
42
	// Hooks
43
	const history = useHistory()
43
	const history = useHistory()
44
	const { action } = useParams()
Línea 44... Línea 45...
44
	const dispatch = useDispatch()
45
	const dispatch = useDispatch()
45
	const { register, setValue, watch, reset } = useForm()
46
	const { register, setValue, watch, reset } = useForm()
Línea 166... Línea 167...
166
							<input type="text" name="name" className='form-control' ref={register({ required: true, maxLength: 50 })} />
167
							<input type="text" name="name" className='form-control' ref={register({ required: true, maxLength: 50 })} />
167
						</div>
168
						</div>
168
						<div className="form-group">
169
						<div className="form-group">
169
							<label htmlFor="form-description">Descripción</label>
170
							<label htmlFor="form-description">Descripción</label>
170
							<DescriptionInput
171
							<DescriptionInput
171
								defaultValue={parse(watch('description'))}
172
								defaultValue={action === 'edit' ? parse(watch('description')) : <p></p>}
172
								name='description'
173
								name='description'
173
								onChange={setValue}
174
								onChange={setValue}
174
							/>
175
							/>
175
						</div>
176
						</div>
176
						<div className="form-group">
177
						<div className="form-group">
177
							<label htmlFor="form-description">Texto</label>
178
							<label htmlFor="form-description">Texto</label>
178
							<DescriptionInput
179
							<DescriptionInput
179
								defaultValue={parse(watch('description'))}
180
								defaultValue={action === 'edit' ? parse(watch('text')) : <p></p>}
180
								name='text'
181
								name='text'
181
								onChange={setValue}
182
								onChange={setValue}
182
							/>
183
							/>
183
						</div>
184
						</div>
184
						<div className="form-group">
185
						<div className="form-group">