Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15353 Rev 15354
Línea 26... Línea 26...
26
		errors,
26
		errors,
27
		handleSubmit,
27
		handleSubmit,
28
		setValue,
28
		setValue,
29
		getValues,
29
		getValues,
30
		clearErrors,
30
		clearErrors,
-
 
31
		reset
31
	} = useForm({
32
	} = useForm({
32
		defaultValues: {
33
		defaultValues: {
33
			description: '',
34
			description: '',
34
			share_width: '',
35
			share_width: '',
35
		}
36
		}
36
	})
37
	})
Línea 37... Línea 38...
37
 
38
 
38
	useEffect(() => {
39
	useEffect(() => {
39
		register('description', { required: 'El campo es requerido' })
40
		register('description', { required: 'El campo es requerido' })
-
 
41
		register('posted_or_shared')
Línea 40... Línea 42...
40
		register('posted_or_shared')
42
		setValue('posted_or_shared', shareModalTypes.POST)
41
 
43
 
42
		if (modalType !== shareModalTypes.POST) {
44
		if (modalType !== shareModalTypes.POST) {
Línea 43... Línea 45...
43
			register('file', { required: 'El campo es requerido' })
45
			register('file', { required: 'El campo es requerido' })
44
		}
46
		}
45
 
-
 
46
		if (modalType === shareModalTypes.POST) {
47
 
47
			if (!getValues('file')) unregister('file')
48
		if (modalType === shareModalTypes.POST) {
Línea 48... Línea 49...
48
			setValue('posted_or_shared', shareModalTypes.POST)
49
			unregister('file')
49
		}
50
		}
Línea 80... Línea 81...
80
								dispatch(addNotification({
81
								dispatch(addNotification({
81
									style: 'danger',
82
									style: 'danger',
82
									msg: `${key}: ${err}`
83
									msg: `${key}: ${err}`
83
								}))
84
								}))
84
							))
85
							))
85
					setLoading(false)
-
 
86
					closeModal()
86
					return
87
				}
87
				}
88
				setLoading(false)
88
				reset()
89
				setValue('description', '')
-
 
90
				setValue('file', '')
-
 
91
				clearErrors()
89
				clearErrors()
92
				closeModal()
-
 
93
				dispatch(addNotification({
90
				dispatch(addNotification({
94
					style: 'success',
91
					style: 'success',
95
					msg: 'La publicación ha sido compartida',
92
					msg: 'La publicación ha sido compartida',
96
				}))
93
				}))
Línea 97... Línea -...
97
 
-
 
98
				if (currentPage && timelineUrl) {
94
 
99
					dispatch(fetchFeeds(timelineUrl, currentPage))
-
 
Línea 100... Línea -...
100
				}
-
 
101
 
95
				if (currentPage && timelineUrl) dispatch(fetchFeeds(timelineUrl, currentPage))
102
				if (feedSharedId) {
-
 
Línea 103... Línea 96...
103
					return dispatch(addFeed(newFeed, feedSharedId))
96
 
104
				}
97
				if (feedSharedId) return dispatch(addFeed(newFeed, feedSharedId))
-
 
98
 
-
 
99
				return dispatch(addFeed(newFeed))
-
 
100
			})
-
 
101
			.catch((err) => dispatch(addNotification({ style: 'danger', msg: `Error: ${err}` })))
105
 
102
			.finally(() => {
106
				return dispatch(addFeed(newFeed))
103
				setLoading(false)
Línea 107... Línea 104...
107
 
104
				closeModal()
108
			})
105
			})