From 4e99bfe1878620769d48532b182692e51c7266ef Mon Sep 17 00:00:00 2001
From: rohan09-raj <rajrohan1914@gmail.com>
Date: Sun, 14 Aug 2022 00:19:58 +0530
Subject: admin panel and api integration

---
 .../src/pages/UnverifiedUsers/UnverifiedUsers.jsx  | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx

(limited to 'admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx')

diff --git a/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx b/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx
new file mode 100644
index 0000000..67de506
--- /dev/null
+++ b/admin/src/pages/UnverifiedUsers/UnverifiedUsers.jsx
@@ -0,0 +1,50 @@
+import React, {useEffect} from 'react';
+import Accordion from '../../components/Accordion/Accordion';
+import Button from '../../components/Button/Button';
+import Header from '../../components/Header/Header';
+import {
+  deleteUser,
+  getUnverifiedUsers,
+  updateUser,
+} from '../../services/apiservice';
+import {useQuery, useMutation} from 'react-query';
+
+import styles from './UnverifiedUsers.module.css';
+
+const UnverifiedUsers = () => {
+  const {data} = useQuery('unverified', getUnverifiedUsers);
+  const deleteUse = useMutation((id) => deleteUser(id));
+  const updateUse = useMutation((id) => updateUser(id, {verified: true}));
+
+  useEffect(() => {}, [data]);
+
+  return (
+    <div className={styles.unverified_users}>
+      <Header subheading='Admin' />
+      <h1 className={styles.unverified_users__heading}>Unverified Users</h1>
+      <div className='accordion'>
+        {data?.data.length !== 0 ? (
+          data?.data.map((item) => (
+            <div className={styles.unverified_users__accordion} key={item._id}>
+              <Accordion name={item.name} user={item} />
+              <Button
+                title='Accept'
+                color='green'
+                onClick={() => updateUse.mutate(item._id)}
+              />
+              <Button
+                title='Reject'
+                color='red'
+                onClick={() => deleteUse.mutate(item._id)}
+              />
+            </div>
+          ))
+        ) : (
+          <div className={styles.unverified_users__nodata}>No Data Found</div>
+        )}
+      </div>
+    </div>
+  );
+};
+
+export default UnverifiedUsers;
-- 
cgit 

