Skip to content

Commit

Permalink
#25 Add handleUnFollow to pages
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraBergstrom committed Jun 29, 2023
1 parent 3572f85 commit cde23d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/contexts/TravelerDataContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const TravelerDataProvider = ({ children }) => {
return (
<TravelerDataContext.Provider value={travelerData}>
<SetTravelerDataContext.Provider
value={{ setTravelerData, handleFollow }}
value={{ setTravelerData, handleFollow, handleUnFollow }}
>
{children}
</SetTravelerDataContext.Provider>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/travelers/Traveler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Traveler = (props) => {
const currentUser = useCurrentUser();
const is_owner = currentUser?.username === owner;

const {handleFollow} = useSetTravelerData();
const {handleFollow, handleUnFollow} = useSetTravelerData();

return (
<div
Expand All @@ -35,7 +35,7 @@ const Traveler = (props) => {
(following_id ? (
<Button
className={`me-1 ${btnStyles.Button} ${btnStyles.Bright}`}
onClick={() => {}}
onClick={() => handleUnFollow(traveler)}
>
unfollow
</Button>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/travelers/TravelerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function TravelerPage() {
const [hasLoaded, setHasLoaded] = useState(false);
const currentUser = useCurrentUser();
const { id } = useParams();
const { setTravelerData, handleFollow } = useSetTravelerData();
const { setTravelerData, handleFollow, handleUnFollow } = useSetTravelerData();
const { pageTraveler } = useTravelerData();
const [traveler] = pageTraveler.results;
const is_owner = currentUser?.username === traveler?.owner;
Expand Down Expand Up @@ -90,7 +90,7 @@ function TravelerPage() {
(traveler?.following_id ? (
<Button
className={`${btnStyles.Button} ${btnStyles.Bright}`}
onClick={() => {}}
onClick={() => handleUnFollow(traveler)}
>
Unfollow
</Button>
Expand Down

0 comments on commit cde23d5

Please sign in to comment.