Skip to content

Commit

Permalink
member-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pratyush3124 committed Mar 15, 2024
1 parent 42dbfc5 commit f7648a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/events/event1/leaderDash/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function LeaderDashboard() {
name={el.name}
Role={el.event1TeamRole === 0 ? 'Leader' : 'Member'}
regNo={el.regNo}
phone={el.mobno}
phone={el.mobNo}
leader={true}
removeMember={() => {
removeMember(el._id);
Expand Down
23 changes: 11 additions & 12 deletions app/events/event1/memberDash/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ const TeamPage = () => {
const router = useRouter();

useEffect(() => {
if (router.isReady) {

if (status === "unauthenticated") {
router.push("/")
} else if(status === "authenticated"){
getData()
fetchDataFromBackend();
}
if (status === "unauthenticated") {
router.push("/")
} else if(status === "authenticated"){
console.log('asdf')
getData()
fetchDataFromBackend();
}
}, [status, router])

Expand All @@ -52,9 +50,10 @@ const TeamPage = () => {
.then((data) => {

const user = data.user;
console.log('user;;', user)
if (user.hasFilledDetails == true) {
if (user.event1TeamId !== null) {
// router.push("/");
router.push("/");
if (user.event1TeamRole === '0') {
router.push('/leaderDashboard')
} else {
Expand All @@ -72,7 +71,7 @@ const TeamPage = () => {

const fetchDataFromBackend = () => {
setIsLoading(true);
fetch('/team/getTeamData', {
fetch('/api/event1/getTeamData', {
content: "application/json",
method: "GET",
headers: {
Expand All @@ -98,7 +97,7 @@ const TeamPage = () => {

const leaveTeam = () => {
setIsLoading(true);
fetch( '/user/leaveTeam/'+teamId, {
fetch( '/api/event1/leaveTeam/'+teamId, {
content: "application/json",
method: "POST",
headers: {
Expand Down Expand Up @@ -138,7 +137,7 @@ const TeamPage = () => {
<div className="flex flex-wrap justify-center">
{
teamMembersData.map(el=>{
return <Card name={el.firstName} key={el.firstName} regNo={el.regNo} Role={el.event1TeamRole==='0'?'Leader':'Member'} leader={false} phone={el.mobno} imageSrc={boardImg} />
return <Card name={el.name} key={el.name} regNo={el.regNo} Role={el.event1TeamRole===0?'Leader':'Member'} leader={false} phone={el.mobNo} imageSrc={boardImg} />
})
}
</div>
Expand Down

0 comments on commit f7648a9

Please sign in to comment.