Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16780 Rev 16782
Línea 73... Línea 73...
73
        playNotifyAudio(newActiveChats[existingChatId].minimized)
73
        playNotifyAudio(newActiveChats[existingChatId].minimized)
74
      }
74
      }
75
    }
75
    }
76
  }
76
  }
Línea 77... Línea 77...
77
 
77
 
-
 
78
  const closeConversation = async (entity) => {
78
  const handleCloseConversation = async (url) => {
79
    axios.post(entity.url_close).then((response) => {
-
 
80
      const { success } = response.data
79
    const { data } = await axios.post(url)
81
 
80
    console.log(data)
82
      if (!success) {
-
 
83
        console.log('Error in entity close')
-
 
84
        return
-
 
85
      }
81
    if (!data.success) console.log('Error in entity close')
86
 
-
 
87
      setActiveChats(
82
    setActiveChats(
88
        activeChats.filter(
-
 
89
          (prevActiveChats) => prevActiveChats.id !== entity.id
-
 
90
        )
83
      activeChats.filter((prevActiveChats) => prevActiveChats.id !== entity.id)
91
      )
84
    )
92
    })
Línea 85... Línea 93...
85
  }
93
  }
86
 
94
 
87
  const handleOpenConversation = async (entity, minimized = false) => {
95
  const handleOpenConversation = async (entity, minimized = false) => {
88
    if (activeChats.some((el) => el.id === entity.id)) {
96
    if (activeChats.some((el) => el.id === entity.id)) {
Línea 89... Línea 97...
89
      return null
97
      return null
90
    }
98
    }
-
 
99
 
91
 
100
    if (activeChats.length >= 3) {
92
    if (activeChats.length >= 3) {
101
      await closeConversation(activeChats[0])
93
      await handleCloseConversation(activeChats[0])
102
 
94
      setActiveChats((prevActiveChats) => [
103
      setActiveChats((prevActiveChats) => [
95
        ...prevActiveChats,
104
        ...prevActiveChats,
Línea 237... Línea 246...
237
            index={index}
246
            index={index}
238
            key={entity.id}
247
            key={entity.id}
239
            entity={entity}
248
            entity={entity}
240
            not_seen_messages={entity.not_seen_messages}
249
            not_seen_messages={entity.not_seen_messages}
241
            minimized={entity.minimized}
250
            minimized={entity.minimized}
242
            onClose={handleCloseConversation}
251
            onClose={closeConversation}
243
            onMinimize={handleMinimizeConversation}
252
            onMinimize={handleMinimizeConversation}
244
            onRead={handleReadConversation}
253
            onRead={handleReadConversation}
245
            timezones={timezones}
254
            timezones={timezones}
246
          />
255
          />
247
        ))}
256
        ))}