diff --git a/src/components/EcosystemInvite/EcoInvitationList.tsx b/src/components/EcosystemInvite/EcoInvitationList.tsx index 8bf8b0f74..3b982b6dc 100644 --- a/src/components/EcosystemInvite/EcoInvitationList.tsx +++ b/src/components/EcosystemInvite/EcoInvitationList.tsx @@ -4,11 +4,13 @@ import React from 'react'; interface InvitationProps{ invitationId:string; invitationEmail:string + ecosytem:[] } const EcoInvitationList = (props: InvitationProps ) => { - const {invitationId, invitationEmail} = props + const {invitationId, invitationEmail,ecosytem} = props + return ( <>
diff --git a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx index 3577fdbb1..1a2e0d986 100644 --- a/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx +++ b/src/components/EcosystemInvite/EcoSystemReceivedInvitations.tsx @@ -26,7 +26,7 @@ const initialPageState = { export interface EcosystemInvitation { - ecosystem: any + ecosystem: [] id: string createDateTime: string createdBy: number @@ -146,7 +146,7 @@ const ReceivedInvitations = () => { if (data?.statusCode === apiStatusCodes.API_STATUS_CREATED) { setMessage(data?.message); setLoading(false); - window.location.href = pathRoutes.ecosystem.profile + window.location.href = pathRoutes.ecosystem.root } else { setError(response as string); setLoading(false); @@ -239,6 +239,7 @@ stroke-linejoin="round"
diff --git a/src/components/EcosystemInvite/SentInvitations.tsx b/src/components/EcosystemInvite/SentInvitations.tsx index 17e3d2a89..ae0ad4c7d 100644 --- a/src/components/EcosystemInvite/SentInvitations.tsx +++ b/src/components/EcosystemInvite/SentInvitations.tsx @@ -65,6 +65,7 @@ const SentInvitations = () => { if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { setLoading(true); await getAllSentInvitations(); + setMessage('Invitation deleted successfully') } else { setError(response as string); } diff --git a/src/components/User/UserDashBoard.tsx b/src/components/User/UserDashBoard.tsx index 1f838e049..075daa27f 100644 --- a/src/components/User/UserDashBoard.tsx +++ b/src/components/User/UserDashBoard.tsx @@ -10,11 +10,11 @@ import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; import { getOrganizations } from '../../api/organization'; import { getUserActivity } from '../../api/users'; import { - getEcosytemReceivedInvitations, + getUserEcosystemInvitations, getUserInvitations, } from '../../api/invitations'; import { pathRoutes } from '../../config/pathRoutes'; -import { setToLocalStorage } from '../../api/Auth'; +import { getFromLocalStorage, setToLocalStorage } from '../../api/Auth'; import { dateConversion } from '../../utils/DateConversion'; import DateTooltip from '../Tooltip'; @@ -49,16 +49,8 @@ const UserDashBoard = () => { if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { const totalPages = data?.data?.totalPages; const invitationList = data?.data?.invitations; - const orgName = invitationList.map( - (invitations: { organisation: { name: string } }) => { - return invitations.organisation.name; - }, - ); - if (invitationList.length > 0) { - setMessage( - `You have received invitations to join ${orgName} organisation`, - ); + setMessage(`You have received invitations to join organisation`); setViewButton(true); } setCurrentPage({ @@ -73,7 +65,7 @@ const UserDashBoard = () => { const getAllEcosystemInvitations = async () => { setLoading(true); - const response = await getEcosytemReceivedInvitations( + const response = await getUserEcosystemInvitations( currentPage.pageNumber, currentPage.pageSize, '', @@ -82,21 +74,14 @@ const UserDashBoard = () => { if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { const totalPages = data?.data?.totalPages; - const invitationList = data?.data; - const ecoSystemName = invitationList.map( - (invitations: { name: string }) => { - return invitations.name; - }, - ); const invitationPendingList = data?.data?.invitations.filter( (invitation: { status: string }) => { return invitation.status === 'pending'; }, ); + if (invitationPendingList.length > 0) { - setEcoMessage( - `You have received invitation to join ${ecoSystemName} ecosystem `, - ); + setEcoMessage(`You have received invitation to join ecosystem `); setViewButton(true); } setCurrentPage({ @@ -154,12 +139,17 @@ const UserDashBoard = () => { setLoading(false); }; - + const checkOrgId = async () => { + const orgId = await getFromLocalStorage(storageKeys.ORG_ID); + if (orgId) { + await getAllEcosystemInvitations(); + } + }; useEffect(() => { getAllInvitations(); getAllOrganizations(); getUserRecentActivity(); - getAllEcosystemInvitations(); + checkOrgId(); }, []); const goToOrgDashboard = async (orgId: number, roles: string[]) => { @@ -193,7 +183,6 @@ const UserDashBoard = () => { setError(null); }} /> - {/* } */}
@@ -202,7 +191,7 @@ const UserDashBoard = () => {

Organizations

- + {organizationsList?.map((org) => { const roles: string[] = org.userOrgRoles.map( (role) => role.orgRole.name, diff --git a/src/pages/ecosystem/index.astro b/src/pages/ecosystem/index.astro index 1437e6e6f..b555bbece 100644 --- a/src/pages/ecosystem/index.astro +++ b/src/pages/ecosystem/index.astro @@ -1,8 +1,16 @@ --- import LayoutSidebar from '../../app/LayoutSidebar.astro'; import Dashboard from '../../components/Ecosystem/Dashboard'; +import { checkUserSession } from '../../utils/check-session'; +import { pathRoutes } from '../../config/pathRoutes'; + +const response = await checkUserSession(Astro.cookies); +const route: string = pathRoutes.auth.sinIn +if (!response) { + return Astro.redirect(route); +} --- - \ No newline at end of file + diff --git a/src/pages/ecosystems/index.astro b/src/pages/ecosystems/index.astro deleted file mode 100644 index ae15c77de..000000000 --- a/src/pages/ecosystems/index.astro +++ /dev/null @@ -1,16 +0,0 @@ ---- -import LayoutSidebar from '../../app/LayoutSidebar.astro'; -import Dashboard from '../../components/Ecosystem/Dashboard'; -import { checkUserSession } from '../../utils/check-session'; -import { pathRoutes } from '../../config/pathRoutes'; - -const response = await checkUserSession(Astro.cookies); -const route: string = pathRoutes.auth.sinIn -if (!response) { - return Astro.redirect(route); -} ---- - - - - \ No newline at end of file