- Timestamp:
- 08/30/22 15:33:18 (2 years ago)
- Branches:
- main
- Children:
- cae16b5
- Parents:
- 2fcbde4
- Location:
- reactapp/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
reactapp/src/App.js
r2fcbde4 r62b653f 21 21 try { 22 22 const response = await axios.get( 23 "http://192.168.0.1 9:8080/secure/currentUser",23 "http://192.168.0.17:8080/secure/currentUser", 24 24 { withCredentials: true } 25 25 ); -
reactapp/src/Components/OpinionTree.js
r2fcbde4 r62b653f 8 8 OpinionReplyCardContentTime, 9 9 StyledFontAwesomeIcon, 10 VoteCount, 10 11 } from "./Styled/OpinionCard.style"; 11 12 import { solid } from "@fortawesome/fontawesome-svg-core/import.macro"; … … 37 38 const [postForModal, setPostForModal] = useState(null); 38 39 39 const handleLike = () => { 40 if (auth) { 40 const handleLike = async (post) => { 41 if ( 42 auth && 43 userLoaded && 44 !post.likes.some((e) => e.id === user.user.id) && 45 !post.dislikes.some((e) => e.id === user.user.id) 46 ) { 47 const response = await axios( 48 `http://192.168.0.17:8080/secure/professor/${professor.professorId}/upvoteOpinion/${post.postId}`, 49 { 50 method: "get", 51 withCredentials: true, 52 } 53 ); 54 55 window.location.reload(false); 56 } else { 41 57 return; 58 } 59 }; 60 61 const handleDislike = async (post) => { 62 if ( 63 auth && 64 auth && 65 userLoaded && 66 !post.likes.some((e) => e.id === user.user.id) && 67 !post.dislikes.some((e) => e.id === user.user.id) 68 ) { 69 const response = await axios( 70 `http://192.168.0.17:8080/secure/professor/${professor.professorId}/downvoteOpinion/${post.postId}`, 71 { 72 method: "get", 73 withCredentials: true, 74 } 75 ); 76 77 window.location.reload(false); 42 78 } else { 43 navigate("/login");44 }45 };46 47 const handleDislike = () => {48 if (auth) {49 79 return; 50 } else {51 navigate("/login");52 80 } 53 81 }; … … 74 102 75 103 const response = await axios( 76 `http://192.168.0.1 9:8080/secure/professor/${professor.professorId}/replyToOpinion/${postId}`,104 `http://192.168.0.17:8080/secure/professor/${professor.professorId}/replyToOpinion/${postId}`, 77 105 { 78 106 method: "post", … … 110 138 icon={solid("thumbs-up")} 111 139 right={50 + "px"} 112 color="greenyellow" 113 onClick={handleLike} 140 color={ 141 child.likes.some((e) => e.id === user.user.id) 142 ? "greenyellow" 143 : "darkgrey" 144 } 145 onClick={() => handleLike(child)} 114 146 /> 147 <VoteCount right={50 + "px"}>{child.likes.length}</VoteCount> 115 148 <StyledFontAwesomeIcon 116 149 icon={solid("thumbs-down")} 117 150 right={10 + "px"} 118 color="indianred" 119 onClick={handleDislike} 151 color={ 152 child.dislikes.some((e) => e.id === user.user.id) 153 ? "indianred" 154 : "darkgrey" 155 } 156 onClick={() => handleDislike(child)} 120 157 /> 158 <VoteCount right={10 + "px"}>{child.dislikes.length}</VoteCount> 121 159 <StyledFontAwesomeIcon 122 160 icon={solid("reply")} 123 161 right={90 + "px"} 124 color=" black"162 color="darkgrey" 125 163 onClick={() => handleReply(child)} 126 164 /> … … 166 204 icon={solid("thumbs-up")} 167 205 right={50 + "px"} 168 color="greenyellow" 169 onClick={handleLike} 206 color={ 207 opinion.likes.some((e) => e.id === user.user.id) 208 ? "greenyellow" 209 : "darkgrey" 210 } 211 onClick={() => handleLike(opinion)} 170 212 /> 213 <VoteCount right={50 + "px"}> 214 {opinion.likes.length} 215 </VoteCount> 171 216 <StyledFontAwesomeIcon 172 217 icon={solid("thumbs-down")} 173 218 right={10 + "px"} 174 color="indianred" 175 onClick={handleDislike} 219 color={ 220 opinion.dislikes.some((e) => e.id === user.user.id) 221 ? "indianred" 222 : "darkgrey" 223 } 224 onClick={() => handleDislike(opinion)} 176 225 /> 226 <VoteCount right={10 + "px"}> 227 {opinion.dislikes.length} 228 </VoteCount> 177 229 <StyledFontAwesomeIcon 178 230 icon={solid("reply")} 179 231 right={90 + "px"} 180 color=" black"232 color="darkgrey" 181 233 onClick={() => handleReply(opinion)} 182 234 /> -
reactapp/src/Components/Search.js
r2fcbde4 r62b653f 15 15 16 16 useEffect(() => { 17 const url = `http://192.168.0.1 9:8080/public/professors/nameContains/${transliterate(17 const url = `http://192.168.0.17:8080/public/professors/nameContains/${transliterate( 18 18 query 19 19 )}`; -
reactapp/src/Components/Styled/OpinionCard.style.js
r2fcbde4 r62b653f 52 52 53 53 export const StyledFontAwesomeIcon = styled(FontAwesomeIcon)` 54 color: darkgrey;54 color: ${(props) => props.color}; 55 55 display: block; 56 56 position: absolute; … … 64 64 } 65 65 `; 66 67 export const VoteCount = styled.p` 68 color: darkgrey; 69 display: block; 70 position: absolute; 71 top: 80%; 72 transform: translateY(-50%); 73 right: ${(props) => props.right}; 74 transition: 0.5s; 75 `; -
reactapp/src/Pages/Professor.js
r2fcbde4 r62b653f 36 36 37 37 useEffect(() => { 38 const url = `http://192.168.0.1 9:8080/public/professor/${params.professorId}`;38 const url = `http://192.168.0.17:8080/public/professor/${params.professorId}`; 39 39 40 40 const fetchData = async () => { … … 70 70 71 71 const response = await axios( 72 `http://192.168.0.1 9:8080/secure/professor/${professor.professorId}/addOpinion`,72 `http://192.168.0.17:8080/secure/professor/${professor.professorId}/addOpinion`, 73 73 { 74 74 method: "post", -
reactapp/src/api/axios.js
r2fcbde4 r62b653f 2 2 3 3 export default axios.create({ 4 baseURL: "http://192.168.0.1 9:8080",4 baseURL: "http://192.168.0.17:8080", 5 5 });
Note:
See TracChangeset
for help on using the changeset viewer.