Skip to content

Commit

Permalink
bugs resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
auraticabhi committed Mar 26, 2024
1 parent 2d19e2d commit 461afa0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
17 changes: 15 additions & 2 deletions components/queAnsPage/AnsPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,14 @@ const AnsPost = ({answers , postTitleWithSpaces , postId }: Props) => {
}, [user]);

const followUser = async (userId: string) => {
if (!user) return;

if (!user||(user&&user.isAnonymous==true)) {
toast({
title: " Please login to follow others ",
variant: "destructive",
});
return;
}

const userRef = doc(db, 'users', user.uid);
await updateDoc(userRef, {
Expand All @@ -161,7 +168,13 @@ const AnsPost = ({answers , postTitleWithSpaces , postId }: Props) => {
};

const unfollowUser = async (userId: string) => {
if (!user) return;
if (!user||(user&&user.isAnonymous==true)) {
toast({
title: " Please login to follow others ",
variant: "destructive",
});
return;
}

const userRef = doc(db, 'users', user.uid);
await updateDoc(userRef, {
Expand Down
5 changes: 3 additions & 2 deletions components/queAnsPage/QuePost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ useEffect(() => {
}, [post.uid, user]);

const handleFollow = async () => {
if (!user) {

if (!user||(user&&user.isAnonymous==true)) {
toast({
title: " Please login to follow others ",
variant: "default",
variant: "destructive",
});
return;
}
Expand Down

0 comments on commit 461afa0

Please sign in to comment.