Skip to content

Commit

Permalink
fix small bug with none auth user.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Ramadan1 committed Jun 5, 2024
1 parent 8e8e63d commit 5aca190
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
24 changes: 17 additions & 7 deletions src/components/courses/courseDetails/CourseEnrollmentDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { toast } from "react-toastify";
import { useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { useState, useEffect } from "react";
import { Link } from "react-router-dom";
import { customFetch } from "../../../utils/customFetch";
import IncludesContainer from "./IncludesContainer";
import useFetchData from "../../../hooks/useFetchData";
Expand Down Expand Up @@ -86,13 +87,22 @@ const CourseEnrollmentDetails = ({
text="Start Now"
/>
) : paymentModel === "free" ? (
<button
type="button"
onClick={handelEnrollFreeCourse}
className=" text-center w-[200px] py-[15px] rounded-xl font-bold bg-[#D5FF40] hover:bg-[#d6ff40d7]"
>
Enroll Now
</button>
user ? (
<button
type="button"
onClick={handelEnrollFreeCourse}
className=" text-center w-[200px] py-[15px] rounded-xl font-bold bg-[#D5FF40] hover:bg-[#d6ff40d7]"
>
Enroll Now
</button>
) : (
<Link
to="/login"
className=" text-center w-[200px] py-[15px] rounded-xl font-bold bg-[#D5FF40] hover:bg-[#d6ff40d7]"
>
Enroll Now
</Link>
)
) : (
<NavigationEnrollmentButton
path={`/paymentGatWay/${courseId}`}
Expand Down
5 changes: 3 additions & 2 deletions src/components/courses/courseDetails/PaymentDetailsInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import WishlistComponent from "../../userProfile/wishlist/WishlistComponent";
import { Link } from "react-router-dom";

import { store } from "../../../store/store";
const PaymentDetailsInfo = ({
paymentModel,
redirectPath,
price,
courseId,
financialAid,
}) => {
const user = store.getState().userReducers.user;
return (
<div className="top-salary w-full relative flex justify-between items-start">
<div>
Expand All @@ -31,7 +32,7 @@ const PaymentDetailsInfo = ({
</div>

<div className="relative">
<WishlistComponent courseId={courseId} />
{user && <WishlistComponent courseId={courseId} />}
</div>
</div>
);
Expand Down

0 comments on commit 5aca190

Please sign in to comment.