Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5814 Rev 5818
Línea 24... Línea 24...
24
import '../templates/linkedin/Feed/Feed.scss'
24
import '../templates/linkedin/Feed/Feed.scss'
Línea 25... Línea 25...
25
 
25
 
26
export default function PostView({ post, labels }) {
26
export default function PostView({ post, labels }) {
27
  const [externalShare, setExternalShare] = useState(post.total_share_external)
27
  const [externalShare, setExternalShare] = useState(post.total_share_external)
-
 
28
  const [ownerReactions, setOwnerReaction] = useState(post.reactions)
28
  const [ownerReactions, setOwnerReaction] = useState(post.reactions)
29
  const [currentReaction, setCurrentReaction] = useState(post.my_reaction)
29
  const [totalReactions, setTotalReactions] = useState(0)
30
  const [totalReactions, setTotalReactions] = useState(0)
30
  const [comments, setComments] = useState([])
31
  const [comments, setComments] = useState([])
31
  const [isReadMoreActive, setIsReadMoreActive] = useState(false)
32
  const [isReadMoreActive, setIsReadMoreActive] = useState(false)
32
  const [showComments, setShowComments] = useState(false)
33
  const [showComments, setShowComments] = useState(false)
Línea 105... Línea 106...
105
      )
106
      )
106
    }
107
    }
107
    return <p>{fullText}</p>
108
    return <p>{fullText}</p>
108
  }
109
  }
Línea 109... Línea 110...
109
 
110
 
110
  const saveReaction = async (type) => {
111
  const saveReaction = (type) => {
111
    const reactionTypesUrl = {
112
    const reactionTypesUrl = {
112
      r: post.save_reaction_recommended_url,
113
      r: post.save_reaction_recommended_url,
113
      s: post.save_reaction_support_url,
114
      s: post.save_reaction_support_url,
114
      l: post.save_reaction_love_url,
115
      l: post.save_reaction_love_url,
115
      i: post.save_reaction_interest_url,
116
      i: post.save_reaction_interest_url,
116
      f: post.save_reaction_fun_url,
117
      f: post.save_reaction_fun_url,
Línea 117... Línea 118...
117
    }
118
    }
118
 
119
 
Línea 119... Línea 120...
119
    await axios.post(reactionTypesUrl[type]).then((res) => {
120
    axios.post(reactionTypesUrl[type]).then((res) => {
120
      const { success, data } = res.data
121
      const { success, data } = res.data
121
 
122
 
Línea 122... Línea 123...
122
      if (!success) {
123
      if (!success) {
123
        dispatch(addNotification({ style: 'danger', msg: data }))
124
        dispatch(addNotification({ style: 'danger', msg: data }))
124
      }
125
      }
125
 
126
 
Línea 126... Línea 127...
126
      setOwnerReaction(data.reactions)
127
      setOwnerReaction(data.reactions)
127
      return true
128
      setCurrentReaction(type)
128
    })
129
    })
Línea 129... Línea 130...
129
  }
130
  }
130
 
131
 
131
  const deleteReaction = async () => {
132
  const deleteReaction = () => {
132
    await axios.post(post.delete_reaction_url).then((res) => {
133
    axios.post(post.delete_reaction_url).then((res) => {
Línea 133... Línea 134...
133
      const { success, data } = res.data
134
      const { success, data } = res.data
134
 
135
 
135
      if (!success) {
136
      if (!success) {
136
        dispatch(addNotification({ style: 'danger', msg: data }))
137
        dispatch(addNotification({ style: 'danger', msg: data }))
Línea 137... Línea 138...
137
        return
138
        return
138
      }
139
      }
139
 
140
 
140
      setOwnerReaction(data.reactions)
141
      setOwnerReaction(data.reactions)
141
      return true
142
      setCurrentReaction('')
Línea 142... Línea 143...
142
    })
143
    })
143
  }
144
  }
144
 
145