diff --git a/package-lock.json b/package-lock.json index a69d89f04..ccb8b324c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mulearnfrontend", - "version": "0.0.0", + "version": "0.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mulearnfrontend", - "version": "0.0.0", + "version": "0.0.4", "dependencies": { "@chakra-ui/react": "^2.6.1", "@emotion/react": "^11.10.6", diff --git a/src/modules/Dashboard/modules/Wadhwani/index.tsx b/src/modules/Dashboard/modules/Wadhwani/index.tsx index 4a4784d63..7196b6d71 100644 --- a/src/modules/Dashboard/modules/Wadhwani/index.tsx +++ b/src/modules/Dashboard/modules/Wadhwani/index.tsx @@ -6,10 +6,13 @@ import { } from "./services/api"; import toast from "react-hot-toast"; import styles from "./index.module.css"; +import MuLoader from "@/MuLearnComponents/MuLoader/MuLoader"; + const Wadhwani = () => { const [data, setData] = useState([]); const [clientToken, setClientToken] = useState(""); + const [isLoading,setIsLoading]=useState(true) useEffect(() => { fetchData(); @@ -29,6 +32,7 @@ const Wadhwani = () => { } else if (courses) { setData(courses); } + setIsLoading(false) } }; @@ -48,7 +52,8 @@ const Wadhwani = () => {

Wadhwani Foundation Courses

- {data.map(course => ( + {isLoading?: + data.map(course => (
{ try { const response = await privateGateway.post( @@ -47,6 +47,7 @@ export const getWadhwaniCourseLink = async ( clientToken: string, courseId: string ) => { + const toastId=toast.loading("Fetching course link...") try { const response = await privateGateway.post( dashboardRoutes.getWadhwaniCourseLink, @@ -61,12 +62,16 @@ export const getWadhwaniCourseLink = async ( const message: wadhwaniCourseRedirectResponse = response?.data?.response; if (message.data?.error?.code) { return { response: null, error: message.data.error.description }; + }else{ + toast.success("Course link opened successfully!",{id:toastId}) } return { response: message, error: null }; - } catch (err: unknown) { + } catch (err: unknown) { + toast.error("Please try again later.",{id:toastId}) const error = err as AxiosError; if (error?.response) { throw error; + } else { return { response: null, error: error.message }; }