Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 11049 Rev 11051
Línea 8... Línea 8...
8
import DescriptionInput from '../../../shared/DescriptionInput'
8
import DescriptionInput from '../../../shared/DescriptionInput'
Línea 9... Línea 9...
9
 
9
 
Línea 10... Línea 10...
10
const AddModal = ({ closeModal, email_link, isOpen, add_link }) => {
10
const AddModal = ({ closeModal, email_link, isOpen, add_link }) => {
11
 
11
 
12
	//Hooks
12
	//Hooks
Línea 13... Línea 13...
13
	const { register, handleSubmit, watch, setError, errors, setValue } = useForm()
13
	const { register, handleSubmit, watch, setError, errors, setValue, clearErrors } = useForm()
14
	const dispatch = useDispatch()
14
	const dispatch = useDispatch()
15
 
15
 
Línea 38... Línea 38...
38
 
38
 
39
		axios.post(add_link, submitData)
39
		axios.post(add_link, submitData)
40
			.then(({ data }) => {
40
			.then(({ data }) => {
41
				if (!data.success) {
41
				if (!data.success) {
42
					dispatch(addNotification({
42
					dispatch(addNotification({
43
						style: 'error',
43
						style: 'danger',
44
						msg: 'Ha ocurrido un error'
44
						msg: 'Ha ocurrido un error'
45
					}))
45
					}))
Línea -... Línea 46...
-
 
46
				}
46
				}
47
 
47
 
48
				clearErrors()
48
				setValue('user_id', data.data.user_id)
49
				closeModal()
49
				dispatch(addNotification({
50
				dispatch(addNotification({
50
					style: 'success',
51
					style: 'success',
51
					msg: 'Usuario registrado'
52
					msg: 'Usuario registrado'
Línea 66... Línea 67...
66
	const checkEmail = () => {
67
	const checkEmail = () => {
67
		axios.get(email_link, { params: { email: watch('email') } })
68
		axios.get(email_link, { params: { email: watch('email') } })
68
			.then(({ data }) => {
69
			.then(({ data }) => {
69
				if (!data.success) {
70
				if (!data.success) {
70
					dispatch(addNotification({
71
					dispatch(addNotification({
71
						style: 'error',
72
						style: 'danger',
72
						msg: 'Ha ocurrido un error'
73
						msg: 'Ha ocurrido un error'
73
					}))
74
					}))
74
				}
75
				}
Línea 75... Línea 76...
75
 
76
 
-
 
77
				setValue('user_id', data.data.user_id)
-
 
78
				setValue('first_name', data.data.first_name)
-
 
79
				setValue('last_name', data.data.last_name)
76
				setValue('user_id', data.data.user_id)
80
				clearErrors()
77
			})
81
			})
Línea 78... Línea 82...
78
	}
82
	}
79
 
83