Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 634 Rev 639
Línea 17... Línea 17...
17
  type: "default",
17
  type: "default",
18
};
18
};
Línea 19... Línea 19...
19
 
19
 
20
export default function withReactions(
20
export default function withReactions(
-
 
21
  Component = <></>,
-
 
22
  {
-
 
23
    saveUrl = "",
21
  Component = <></>,
24
    deleteUrl = "",
-
 
25
    currentReaction = "default",
-
 
26
    onSelect = () => null,
22
  { saveUrl = "", deleteUrl = "", currentReaction = "default" } = {}
27
  } = {}
23
) {
28
) {
24
  return function (props) {
29
  return function (props) {
25
    const [reaction, setReaction] = useState(initialReaction);
30
    const [reaction, setReaction] = useState(initialReaction);
26
    const [isHover, setIsHover] = useState(false);
31
    const [isHover, setIsHover] = useState(false);
Línea 66... Línea 71...
66
        if (!success) {
71
        if (!success) {
67
          dispatch(addNotification({ style: "danger", msg: data }));
72
          dispatch(addNotification({ style: "danger", msg: data }));
68
          return;
73
          return;
69
        }
74
        }
Línea 70... Línea 75...
70
 
75
 
71
        const newReaction = reactions.find(
-
 
72
          (reaction) => reaction.type === type
-
 
73
        );
76
        const newReaction = reactions.find((r) => r.type === type);
-
 
77
        setReaction(newReaction);
74
        setReaction(newReaction);
78
        onSelect(data.reactions);
75
      });
79
      });
Línea 76... Línea 80...
76
    };
80
    };
77
 
81
 
Línea 83... Línea 87...
83
          dispatch(addNotification({ style: "danger", msg: data }));
87
          dispatch(addNotification({ style: "danger", msg: data }));
84
          return;
88
          return;
85
        }
89
        }
Línea 86... Línea 90...
86
 
90
 
-
 
91
        setReaction(initialReaction);
87
        setReaction(initialReaction);
92
        onSelect(data.reactions);
88
      });
93
      });
Línea 89... Línea 94...
89
    };
94
    };