Skip to content

Commit

Permalink
issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
anmode committed Oct 19, 2023
1 parent fe1e6a6 commit 675e9d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NEXT_PUBLIC_GOOGLE_CLIENT_ID="onlyForProdMode"

## If you backend server running on localhost you can this one.
# NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
NEXT_PUBLIC_BACKEND_URL=https://api.grabtern.com
NEXT_PUBLIC_BACKEND_URL=https://demoapi.grabtern.com
#up is the prod. link

## To use production one please uncomment this one( this is for OSS community)
Expand Down
26 changes: 13 additions & 13 deletions pages/mentorList.page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import dynamic from "next/dynamic";
import { LuSearch } from "react-icons/lu";
import MentorCard from "../components/mentor";
Expand All @@ -12,23 +12,23 @@ const SimpleBanner = dynamic(() => import("../components/basic/SimpleBanner"));

function Mentors() {
const [query, setQuery] = useState("");
const { apidata, isLoading } = useApi(
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/mentors/mentorLists`,
true
);

try {
// Use the useApi hook to fetch and cache data
const { apidata, isLoading } = useApi(
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/mentors/mentorLists`,
true,
);
} catch (error) {
toast.error("Error in fetching mentorslist");
console.error("Error in fetching mentorslist ", error);
}
useEffect(() => {
// You can handle errors and show a toast message here
if (!isLoading && !apidata) {
toast.error("Error in fetching mentors list");
}
}, [isLoading, apidata]);

const filteredMentors = apidata.filter(
const filteredMentors = apidata?.filter(
(mentor) =>
mentor.name.toLowerCase().includes(query.toLowerCase()) ||
mentor.internAt.toLowerCase().includes(query.toLowerCase()) ||
mentor.currentStatus.toLowerCase().includes(query.toLowerCase()),
mentor.currentStatus.toLowerCase().includes(query.toLowerCase())
);

return (
Expand Down

0 comments on commit 675e9d8

Please sign in to comment.