Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6989 Rev 6990
Línea 26... Línea 26...
26
  ])
26
  ])
27
  const { uuid } = useParams()
27
  const { uuid } = useParams()
28
  const labels = useSelector(({ intl }) => intl.labels)
28
  const labels = useSelector(({ intl }) => intl.labels)
29
  const dispatch = useDispatch()
29
  const dispatch = useDispatch()
Línea 30... Línea -...
30
 
-
 
31
  const toggleConversationModal = () => {
-
 
32
    setShowConversationModal(!showConversationModal)
-
 
33
  }
-
 
34
 
30
 
35
  const getConversations = async () => {
31
  const getConversations = async () => {
36
    setLoading(true)
32
    setLoading(true)
37
    axios
33
    axios
38
      .get(window.location.href)
34
      .get(window.location.href)
Línea 42... Línea 38...
42
        if (!success) {
38
        if (!success) {
43
          return
39
          return
44
        }
40
        }
Línea 45... Línea 41...
45
 
41
 
46
        const resConversations = data
-
 
47
        const newConversations = resConversations.reduce(
-
 
48
          (acum, conversation) => {
-
 
49
            const messageIndex = conversations.findIndex(({ uuid }) => {
-
 
50
              console.log(uuid)
-
 
51
              console.log(conversation.uuid)
-
 
52
              return uuid === conversation.uuid
-
 
53
            })
-
 
54
 
-
 
55
            if (messageIndex === -1) {
-
 
56
              acum = [...acum, conversation]
-
 
57
            }
-
 
58
 
-
 
59
            return acum
-
 
60
          },
-
 
61
          []
-
 
Línea -... Línea 42...
-
 
42
        const resConversations = data
-
 
43
 
-
 
44
        const diff1 = conversations.filter(
62
        )
45
          ({ uuid }) => !resConversations.some((conv) => conv.uuid === uuid)
-
 
46
        )
-
 
47
        const diff2 = resConversations.filter(
Línea 63... Línea 48...
63
 
48
          ({ uuid }) => !conversations.some((conv) => conv.uuid === uuid)
64
        console.log(newConversations)
49
        )
65
 
50
 
Línea 66... Línea 51...
66
        if (!newConversations.length) {
51
        if (!diff1.concat(diff2).length) {
67
          return
52
          return
Línea 89... Línea 74...
89
      ),
74
      ),
Línea 90... Línea 75...
90
 
75
 
91
    [search, conversations]
76
    [search, conversations]
Línea -... Línea 77...
-
 
77
  )
-
 
78
 
-
 
79
  const toggleConversationModal = () => {
-
 
80
    setShowConversationModal(!showConversationModal)
92
  )
81
  }
93
 
82
 
Línea 94... Línea 83...
94
  useEffect(() => {
83
  useEffect(() => {
95
    if (loading) return
84
    if (loading) return