diff --git a/components/matchedResults.tsx b/components/matchedResults.tsx index 7edd486..682237b 100644 --- a/components/matchedResults.tsx +++ b/components/matchedResults.tsx @@ -8,37 +8,17 @@ import { Matched_Ids, Matches } from '@/utils/UserData'; const Results = () => { -// let Matches: Student[] = [] - - -// useEffect(() => { -// // Fetching Data of the Matched_Ids for Displaying -// const display_result = async() => { -// await get_result(); -// for(let j=0; j < Matched_Ids.length; j++) { -// const data: Array = search_students(Matched_Ids[j]); -// if(!data.length) { -// return; -// } -// const student = data[0]; -// Matches.push(student) -// } -// console.log(Matches) -// } -// display_result(); -// }, []) - -// console.log(Matches) return (
{Matches.map((student) => ( - + // +
{student.i}
))} -
+ ); }; diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index 5228fc5..41addba 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -13,11 +13,12 @@ import "../app/globals.css"; import GoToTop from '@/components/GoToTop'; import { useRouter } from 'next/router'; import Clear from '@/components/clear';import { SendHeart } from '@/utils/API_Calls/Send_Heart'; -import {receiverIds, setUser, user} from '../utils/UserData'; +import {Matched_Ids, receiverIds, setMatches, setUser, user} from '../utils/UserData'; import { handle_Logout } from '@/utils/API_Calls/login_api'; import { Id, Submit} from "../utils/UserData" import Link from 'next/link'; import { search_students,Student } from '@/utils/API_Calls/search'; +import { get_result } from '@/utils/API_Calls/get_results'; const SERVER_IP = process.env.SERVER_IP @@ -201,6 +202,23 @@ const New = () => { setShowStud(!isShowStud); } + useEffect(() => { + const show_result = async() => { + await get_result(); + setMatches([]) + for(let j=0; j < Matched_Ids.length; j++) { + const data: Array = search_students(Matched_Ids[j]); + if(!data.length) { + return; + } + const student = data[0]; + console.log(student) + setMatches(student) + } + } + show_result(); + }, []) + const stylesss = { backgroundImage: `url("https://home.iitk.ac.in/~${user?.u}/dp"), url("https://oa.cc.iitk.ac.in/Oa/Jsp/Photo/${user?.i}_0.jpg"), url("/dummy.png")`, }; diff --git a/pages/result.tsx b/pages/result.tsx index aa76cb9..48757a6 100644 --- a/pages/result.tsx +++ b/pages/result.tsx @@ -13,23 +13,6 @@ import { get_result } from "@/utils/API_Calls/get_results"; const ResultPage = () => { - useEffect(() => { - const show_result = async() => { - await get_result(); - for(let j=0; j < Matched_Ids.length; j++) { - const data: Array = search_students(Matched_Ids[j]); - if(!data.length) { - return; - } - const student = data[0]; - setMatches(student) - } - } - show_result(); - }, []) - - - const stylesss = { backgroundImage: `url("https://home.iitk.ac.in/~${user?.u}/dp"), url("https://oa.cc.iitk.ac.in/Oa/Jsp/Photo/${user?.i}_0.jpg"), url("/dummy.png")`, };