Skip to content

Commit 0073f77

Browse files
authored
fixing errors that appear in the console log (#359)
1 parent d0ea3fa commit 0073f77

File tree

7 files changed

+329
-320
lines changed

7 files changed

+329
-320
lines changed

src/ProtectedRoute.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ interface SomeType {
88
}
99
// eslint-disable-next-line react/prop-types
1010
export default function ProtectedRoutes(obj: SomeType) {
11-
/* istanbul ignore if */
12-
if (window.location.pathname === '/users/login') {
13-
/* istanbul ignore next */
14-
checkOrgTokenExpiration();
15-
}
1611
const { user } = useContext(UserContext);
12+
/* istanbul ignore next */
13+
checkOrgTokenExpiration();
14+
1715
if (!user?.auth) {
1816
return obj.children;
1917
}

src/components/Organizations.tsx

Lines changed: 105 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import CreateOrganizationModal, {
88
import { gql, useMutation, useQuery } from '@apollo/client';
99
import useDocumentTitle from '../hook/useDocumentTitle';
1010
import Button from './Buttons';
11+
import Tooltip from '@mui/material/Tooltip';
1112
import { toast } from 'react-toastify';
1213
import { Icon } from '@iconify/react';
1314

14-
import DataTable from '../components/DataTable'
15+
import DataTable from '../components/DataTable';
1516

1617
export interface Admin {
1718
id: string;
@@ -66,84 +67,89 @@ export const RegisterNewOrganization = gql`
6667
`;
6768

6869
function ActionButtons({
69-
getData,
70-
setData,
71-
removeInviteModel,
72-
removeDeleteModel,
73-
approveModel,
74-
rejectModel,
75-
...props
76-
}: any) {
77-
const checkStatus = getData?.getOrganizations[props.row.index].status
78-
return (
79-
<div className="flex relative flex-row align-middle justify-center items-center">
80-
{checkStatus == 'active' ? (
81-
<>
82-
<div
83-
onClick={() => {
84-
setData(getData?.getOrganizations[props.row.index]);
85-
console.log(getData?.getOrganizations[props.row.index])
86-
removeInviteModel();
87-
}}
88-
>
89-
<Icon
90-
icon="mdi:email-fast"
91-
width="30"
92-
height="30"
93-
cursor="pointer"
94-
color="#9e85f5"
95-
/>
96-
</div>
97-
<div
98-
onClick={() => {
99-
setData(getData?.getOrganizations[props.row.index]);
100-
removeDeleteModel();
101-
}}
102-
>
103-
<Icon
104-
icon="mdi:delete"
105-
width="30"
106-
height="30"
107-
cursor="pointer"
108-
color="#9e85f5"
109-
/>
110-
</div>
111-
</>
112-
) : (
113-
<>
114-
<div
115-
onClick={() => {
116-
setData(getData?.getOrganizations[props.row.index]);
117-
approveModel();
118-
}}
119-
>
120-
<Icon
121-
icon="mdi:bank-check"
122-
width="30"
123-
height="30"
124-
cursor="pointer"
125-
color="#9e85f5"
126-
/>
127-
</div>
128-
<div
129-
onClick={() => {
130-
setData(getData?.getOrganizations[props.row.index]);
131-
rejectModel();
132-
}}
133-
>
134-
<Icon
135-
icon="mdi:bank-remove"
136-
width="30"
137-
height="30"
138-
cursor="pointer"
139-
color="#9e85f5"
140-
/>
141-
</div>
142-
</>
143-
)}
144-
</div>
145-
);
146-
}
70+
getData,
71+
setData,
72+
removeInviteModel,
73+
removeDeleteModel,
74+
approveModel,
75+
rejectModel,
76+
...props
77+
}: any) {
78+
const checkStatus = getData?.getOrganizations[props.row.index].status;
79+
return (
80+
<div className="flex relative flex-row align-middle justify-center items-center">
81+
{checkStatus == 'active' ? (
82+
<>
83+
<div
84+
onClick={() => {
85+
setData(getData?.getOrganizations[props.row.index]);
86+
removeInviteModel();
87+
}}
88+
>
89+
<Tooltip title="Send Email">
90+
<Icon
91+
icon="mdi:email-fast"
92+
width="30"
93+
height="30"
94+
cursor="pointer"
95+
color="#9e85f5"
96+
/>
97+
</Tooltip>
98+
</div>
99+
<div
100+
onClick={() => {
101+
setData(getData?.getOrganizations[props.row.index]);
102+
removeDeleteModel();
103+
}}
104+
>
105+
<Icon
106+
icon="mdi:delete"
107+
width="30"
108+
height="30"
109+
cursor="pointer"
110+
color="#9e85f5"
111+
/>
112+
</div>
113+
</>
114+
) : (
115+
<>
116+
<div
117+
onClick={() => {
118+
setData(getData?.getOrganizations[props.row.index]);
119+
approveModel();
120+
}}
121+
>
122+
<Tooltip title="Approve">
123+
<Icon
124+
icon="mdi:bank-check"
125+
width="30"
126+
height="30"
127+
cursor="pointer"
128+
color="#9e85f5"
129+
/>
130+
</Tooltip>
131+
</div>
132+
<div
133+
onClick={() => {
134+
setData(getData?.getOrganizations[props.row.index]);
135+
rejectModel();
136+
}}
137+
>
138+
<Tooltip title="Reject">
139+
<Icon
140+
icon="mdi:bank-remove"
141+
width="30"
142+
height="30"
143+
cursor="pointer"
144+
color="#9e85f5"
145+
/>
146+
</Tooltip>
147+
</div>
148+
</>
149+
)}
150+
</div>
151+
);
152+
}
147153

148154
const Organizations = () => {
149155
useDocumentTitle('Organizations');
@@ -174,8 +180,8 @@ const Organizations = () => {
174180
id: '',
175181
name: '',
176182
admin: {
177-
id:'',
178-
email:''
183+
id: '',
184+
email: '',
179185
},
180186
description: '',
181187
});
@@ -287,12 +293,14 @@ const Organizations = () => {
287293
},
288294
];
289295

290-
const organizationData = getData?.getOrganizations.map(({ name, description, admin, status }) => ({
291-
name,
292-
adminEmail: admin?.email,
293-
description,
294-
status,
295-
}));
296+
const organizationData = getData?.getOrganizations.map(
297+
({ name, description, admin, status }) => ({
298+
name,
299+
adminEmail: admin?.email,
300+
description,
301+
status,
302+
}),
303+
);
296304

297305
return (
298306
<>
@@ -321,7 +329,9 @@ const Organizations = () => {
321329
<form className=" py-3 px-8">
322330
<div>
323331
<h2 className="text-base dark:text-white text-center m-4">
324-
{t('Are you sure you want to permanently delete this organization?')}
332+
{t(
333+
'Are you sure you want to permanently delete this organization?',
334+
)}
325335
</h2>
326336
</div>
327337
<div className="w-full flex justify-between">
@@ -358,13 +368,13 @@ const Organizations = () => {
358368
</div>
359369
{/* =========================== End:: delete Session Model =============================== */}
360370

361-
{/* =========================== Start:: SendInviteModel =============================== */}
371+
{/* =========================== Start:: SendInviteModel =============================== */}
362372

363-
<div
364-
className={`h-screen w-screen bg-black fixed top-0 left-0 z-20 bg-opacity-30 backdrop-blur-sm flex items-center justify-center overflow-auto p-4 ${
365-
sendInviteModel === true ? 'block' : 'hidden'
366-
}`}
367-
>
373+
<div
374+
className={`h-screen w-screen bg-black fixed top-0 left-0 z-20 bg-opacity-30 backdrop-blur-sm flex items-center justify-center overflow-auto p-4 ${
375+
sendInviteModel === true ? 'block' : 'hidden'
376+
}`}
377+
>
368378
<div className="bg-white dark:bg-dark-bg w-full sm:w-3/4 xl:w-4/12 rounded-lg p-4 pb-8">
369379
<div className="card-title w-full flex flex-wrap justify-center items-center ">
370380
<h3 className="font-bold text-xl dark:text-white text-center w-11/12">
@@ -489,7 +499,7 @@ const Organizations = () => {
489499
<div className="card-title w-full flex flex-wrap justify-center items-center ">
490500
<h3 className="font-bold text-xl dark:text-white text-center w-11/12">
491501
{t('Reject New Organization Request')}
492-
</h3>
502+
</h3>
493503
<hr className=" bg-primary border-b my-3 w-full" />
494504
</div>
495505
<div className="card-body">

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { toast, ToastContainer } from 'react-toastify';
1818
import 'react-toastify/dist/ReactToastify.css';
1919
import UserProvider from './hook/useAuth';
2020
import { WebSocketLink } from '@apollo/client/link/ws';
21+
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
2122
import { t } from 'i18next';
2223
import { getMainDefinition } from '@apollo/client/utilities';
2324
import App from './App';

0 commit comments

Comments
 (0)