Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 14838 Rev 14864
Línea 8... Línea 8...
8
import { useDispatch, useSelector } from 'react-redux'
8
import { useDispatch, useSelector } from 'react-redux'
9
import DropzoneComponent from './Dropzone/DropzoneComponent'
9
import DropzoneComponent from './Dropzone/DropzoneComponent'
10
import { addFeed, fetchFeeds } from '../redux/feed/feed.actions'
10
import { addFeed, fetchFeeds } from '../redux/feed/feed.actions'
11
import { addNotification } from '../redux/notification/notification.actions'
11
import { addNotification } from '../redux/notification/notification.actions'
12
import Spinner from './Spinner'
12
import Spinner from './Spinner'
-
 
13
import { CKEditor } from 'ckeditor4-react'
-
 
14
import { config } from './helpers/ckeditor_config'
Línea 13... Línea 15...
13
 
15
 
Línea 14... Línea 16...
14
const ShareModal = () => {
16
const ShareModal = () => {
15
 
17
 
Línea 40... Línea 42...
40
			required: { value: 'true', message: 'El campo es requerido' },
42
			required: { value: 'true', message: 'El campo es requerido' },
41
		})
43
		})
42
		register('posted_or_shared')
44
		register('posted_or_shared')
43
		if (
45
		if (
44
			modalType !== shareModalTypes.POST &&
46
			modalType !== shareModalTypes.POST &&
45
            modalType !== shareModalTypes.SHARE
47
			modalType !== shareModalTypes.SHARE
46
		) {
48
		) {
47
			register('file', {
49
			register('file', {
48
				required: { value: 'true', message: 'El campo es requerido' },
50
				required: { value: 'true', message: 'El campo es requerido' },
49
			})
51
			})
50
		} else {
52
		} else {
Línea 79... Línea 81...
79
		axios.post(postUrl, currentFormData)
81
		axios.post(postUrl, currentFormData)
80
			.then(({ data }) => {
82
			.then(({ data }) => {
81
				const newFeed = data.data
83
				const newFeed = data.data
Línea 82... Línea 84...
82
 
84
 
83
				/* if (data.data.description || data.data.file || data.data.share_width) {
85
				/* if (data.data.description || data.data.file || data.data.share_width) {
84
                    return Object.entries(data.data).map(([key, value]) => {
86
					return Object.entries(data.data).map(([key, value]) => {
85
                        setError(key, { type: "required", message: value })
87
						setError(key, { type: "required", message: value })
86
                    })
88
					})
Línea 87... Línea 89...
87
                } */
89
				} */
88
 
90
 
89
				if (data.success) {
91
				if (data.success) {
90
					setLoading(false)
92
					setLoading(false)
Línea 140... Línea 142...
140
					{loading
142
					{loading
141
						?
143
						?
142
						<Spinner />
144
						<Spinner />
143
						:
145
						:
144
						<>
146
						<>
145
							<DescriptionInput
147
							<CKEditor
146
								name="description"
148
								onChange={(e) => setValue('description', e.editor.getData())}
147
								onChange={setValue}
149
								config={config}
148
							/>
150
							/>
149
							{errors.description && <p>{errors.description.message}</p>}
151
							{errors.description && <p>{errors.description.message}</p>}
150
							{
152
							{
151
								modalType !== shareModalTypes.POST
153
								modalType !== shareModalTypes.POST
152
                                &&
154
								&&
153
                                <DropzoneComponent
155
								<DropzoneComponent
154
                                	modalType={modalType}
156
									modalType={modalType}
155
                                	onUploaded={onUploadedHandler}
157
									onUploaded={onUploadedHandler}
156
                                	settedFile={getValues('file')}
158
									settedFile={getValues('file')}
157
                                	recomendationText={recomendationText[modalType]}
159
									recomendationText={recomendationText[modalType]}
158
                                />
160
								/>
159
							}
161
							}
160
							{errors.file && <p>{errors.file.message}</p>}
162
							{errors.file && <p>{errors.file.message}</p>}
161
						</>
163
						</>
162
					}
164
					}
163
				</Modal.Body>
165
				</Modal.Body>
Línea 165... Línea 167...
165
					<Button
167
					<Button
166
						size="sm"
168
						size="sm"
167
						type="submit"
169
						type="submit"
168
						disabled={loading}
170
						disabled={loading}
169
					>
171
					>
170
                        Enviar
172
						Enviar
171
					</Button>
173
					</Button>
172
					<Button
174
					<Button
173
						color="danger"
175
						color="danger"
174
						size="sm"
176
						size="sm"
175
						variant="danger"
177
						variant="danger"
176
						onClick={closeModal}
178
						onClick={closeModal}
177
						disabled={loading}
179
						disabled={loading}
178
					>
180
					>
179
                        Cancelar
181
						Cancelar
180
					</Button>
182
					</Button>
181
				</Modal.Footer>
183
				</Modal.Footer>
182
			</form>
184
			</form>
183
		</Modal>
185
		</Modal>
184
	)
186
	)