Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7088 Rev 7233
Línea 16... Línea 16...
16
      setLoading(true)
16
      setLoading(true)
17
      const { data: response } = await axios.get(url)
17
      const { data: response } = await axios.get(url)
18
      const { total_messages, total_notifications } = response.data
18
      const { total_messages, total_notifications } = response.data
Línea 19... Línea 19...
19
 
19
 
20
      if (response.success) {
20
      if (response.success) {
21
        setMessagesCount(Number(total_messages))
21
        const msgs = Number(total_messages)
-
 
22
        const nots = Number(total_notifications)
-
 
23
 
-
 
24
        msgs !== messagesCount && setMessagesCount(msgs)
22
        setNotificationsCount(Number(total_notifications))
25
        nots !== notificationsCount && setNotificationsCount(nots)
-
 
26
      }
23
      }
27
 
24
      setLoading(false)
28
      setLoading(false)
25
    } catch (error) {
29
    } catch (error) {
26
      console.log(error)
30
      throw new Error(error)
27
    }
31
    }
Línea 28... Línea 32...
28
  }
32
  }
29
 
33
 
Línea 90... Línea 94...
90
    return () => {
94
    return () => {
91
      clearTimeout(timer)
95
      clearTimeout(timer)
92
    }
96
    }
93
  }, [loading, backendVars])
97
  }, [loading, backendVars])
Línea -... Línea 98...
-
 
98
 
-
 
99
  useEffect(() => {
-
 
100
    const newMenu = [...backendVars.menu]
-
 
101
    const comunications = newMenu[newMenu.length - 1]
-
 
102
 
-
 
103
    comunications.childs.forEach.map((child) => {
-
 
104
      if (child.label === 'Inmail') {
-
 
105
        child.count = messagesCount
-
 
106
      }
-
 
107
      if (child.label === 'Notificaciones') {
-
 
108
        child.count = notificationsCount
-
 
109
      }
-
 
110
    })
-
 
111
 
-
 
112
    newMenu[newMenu.length - 1] = comunications
-
 
113
 
-
 
114
    setBackendVars((prevVars) => {
-
 
115
      return {
-
 
116
        ...prevVars,
-
 
117
        menu: newMenu,
-
 
118
      }
-
 
119
    })
-
 
120
  }, [messagesCount, notificationsCount])
94
 
121
 
95
  if (theme === 2) {
122
  if (theme === 2) {
96
    return (
123
    return (
97
      <LinkendInHeader
124
      <LinkendInHeader
98
        menu={backendVars?.menu}
125
        menu={backendVars?.menu}