Skip to content

Commit

Permalink
removed bookmark btn logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivaBhattacharjee committed Nov 8, 2023
1 parent 4a01fba commit c9b441b
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/components/buttons/AddToBookmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,16 @@ const AddToBookmark = ({ animeId, image, title, isStream }: BookmarkProps) => {
const [bookmarkCheckLoading, setBookmarkCheckLoading] = useState(false);

const checkBookmarkStatus = async () => {
console.log("Checking bookmark status for animeId:", animeId);
if (token) {
setBookmarkCheckLoading(true);
try {
setBookmarkCheckLoading(false);
const response = await axios.get("/api/bookmark");
const { userBookmarks } = response.data;
console.log("User bookmarks:", userBookmarks);
const isAnimeBookmarked = userBookmarks.bookmarks.some((bookmark: BookmarkProps) => bookmark.animeId == animeId);
console.log("Is anime bookmarked?", isAnimeBookmarked);
setIsBookmarked(isAnimeBookmarked);
} catch (error) {
setBookmarkCheckLoading(false);
console.error("Error checking bookmark status:", error);
} finally {
setBookmarkCheckLoading(false);
}
Expand All @@ -53,20 +49,17 @@ const AddToBookmark = ({ animeId, image, title, isStream }: BookmarkProps) => {
title: title,
};
const res = await axios.post("/api/bookmark", data);
console.log(res);
Toast.SuccessshowToast(res.data.message || "Added to bookmark");
checkBookmarkStatus();
} catch (error: unknown) {
const Error = error as Error;
console.log(Error);
Toast.ErrorShowToast(Error?.response?.data?.error || "Something Went Wrong");
}
} else {
Toast.ErrorShowToast("Please Login First");
}
};
const deleteBookmark = async (animeId: number) => {
console.log("Deleting bookmark for animeId:", animeId);
const parsedAnimeId = parseInt(animeId.toString());
try {
const data = {
Expand All @@ -78,7 +71,6 @@ const AddToBookmark = ({ animeId, image, title, isStream }: BookmarkProps) => {
} catch (error: unknown) {
const Error = error as Error;
Toast.ErrorShowToast(Error?.response?.data?.error || "Something went wrong");
console.log(error);
}
};

Expand Down

0 comments on commit c9b441b

Please sign in to comment.