Skip to content

Commit

Permalink
fixed: added alert component
Browse files Browse the repository at this point in the history
Signed-off-by: bhavanakarwade <[email protected]>
  • Loading branch information
bhavanakarwade committed Aug 2, 2023
1 parent a96272b commit 7f80c48
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 10 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions src/components/organization/OrganizationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ const OrganizationsList = () => {
return userOrg;
})

if (orgList.length === 0) {
setError('No Data Found')
}

setOrganizationList(orgList)
setCurrentPage({
...currentPage,
total: totalPages
})
}
else{
setError(response as string)

}
setLoading(false)
}

Expand Down Expand Up @@ -151,6 +151,16 @@ const OrganizationsList = () => {
setOpenModal={
props.setOpenModal
} />

<AlertComponent
message={message ? message : error}
type={message ? 'success' : 'failure'}
onAlertClose={() => {
setMessage(null)
setError(null)
}}
/>

{loading
? <div className="flex items-center justify-center mb-4">
<Spinner
Expand Down
16 changes: 13 additions & 3 deletions src/components/organization/invitations/Invitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ const Invitations = () => {

const invitationList = data?.data?.invitations

if (invitationList.length === 0) {
setError('No Data Found')
}
setInvitationsList(invitationList)
setCurrentPage({
...currentPage,
total: totalPages
})
}
else {
setError(response as string)

}
}

//This useEffect is called when the searchText changes
Expand Down Expand Up @@ -123,6 +124,15 @@ const Invitations = () => {
props.setOpenModal
} />

<AlertComponent
message={message ? message : error}
type={message ? 'success' : 'failure'}
onAlertClose={() => {
setMessage(null)
setError(null)
}}
/>

{loading
? <div className="flex items-center justify-center mb-4">
<Spinner
Expand Down
17 changes: 14 additions & 3 deletions src/components/organization/invitations/ReceivedInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,16 @@ const ReceivedInvitations = () => {
const totalPages = data?.data?.totalPages;

const invitationList = data?.data?.invitations
if (invitationList.length === 0) {
setError('No Data Found')
}

setInvitationsList(invitationList)
setCurrentPage({
...currentPage,
total: totalPages
})
}
else {
setError(response as string)
}

setLoading(false)
}
Expand Down Expand Up @@ -135,6 +136,16 @@ const ReceivedInvitations = () => {
props.setOpenModal
} />

<AlertComponent
message={message ? message : error}
type={message ? 'success' : 'failure'}
onAlertClose={() => {
setMessage(null)
setError(null)
}}
/>


{loading
? <div className="flex items-center justify-center mb-4">
<Spinner
Expand Down

0 comments on commit 7f80c48

Please sign in to comment.