Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2075 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 2075 Rev 2121
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from 'react'
-
 
2
import { useHistory } from 'react-router-dom'
2
import { useSelector } from 'react-redux'
3
import { useSelector } from 'react-redux'
3
import {
4
import {
4
  Avatar,
5
  Avatar,
5
  List,
6
  List,
6
  ListItem,
7
  ListItem,
Línea 17... Línea 18...
17
 
18
 
18
const StartConversationModal = ({ show, setConversation, onClose }) => {
19
const StartConversationModal = ({ show, setConversation, onClose }) => {
19
  const [users, setUsers] = useState([])
20
  const [users, setUsers] = useState([])
20
  const [search, setSearch] = useState('')
21
  const [search, setSearch] = useState('')
-
 
22
  const debouncedSearch = useDebounce(search, 500)
21
  const debouncedSearch = useDebounce(search, 500)
23
  const history = useHistory()
Línea 22... Línea 24...
22
  const labels = useSelector(({ intl }) => intl.labels)
24
  const labels = useSelector(({ intl }) => intl.labels)
23
 
25
 
24
  const searchUsers = async (value) => {
26
  const searchUsers = async (value) => {
Línea 29... Línea 31...
29
      console.log('>>: error > ', error)
31
      console.log('>>: error > ', error)
30
    }
32
    }
31
  }
33
  }
Línea 32... Línea 34...
32
 
34
 
33
  const openChat = (uuid) => {
35
  const openChat = (uuid) => {
34
    axios.get(`/inmail/${uuid}`).then(({ data }) => {
-
 
35
      if (data.success) {
-
 
36
        const newConversation = data.data.find(
-
 
37
          (conversation) => conversation.uuid === uuid
-
 
38
        )
-
 
39
        setConversation(newConversation)
-
 
40
      }
-
 
41
    })
-
 
42
 
36
    history.replace(`/inmail/${uuid}`)
43
    onClose()
37
    onClose()
Línea 44... Línea 38...
44
  }
38
  }
45
 
39