eleven-solutions-common-website-unique-web 1.0.29 → 1.0.30
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { useState, useEffect } from "react";
|
12
12
|
import { FaPlus } from "react-icons/fa";
|
13
13
|
import { fetchUsersApi, deleteUserApi } from "../api/user";
|
14
|
-
function Users() {
|
14
|
+
function Users({ handleNav }) {
|
15
15
|
const [users, setUsers] = useState([]);
|
16
16
|
const fetchUsersData = () => __awaiter(this, void 0, void 0, function* () {
|
17
17
|
const data = yield fetchUsersApi();
|
@@ -25,13 +25,13 @@ function Users() {
|
|
25
25
|
useEffect(() => {
|
26
26
|
fetchUsersData();
|
27
27
|
}, []);
|
28
|
-
const handleNav = (e) => {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
};
|
28
|
+
// const handleNav = (e: React.FormEvent) => {
|
29
|
+
// e.preventDefault();
|
30
|
+
// window.history.pushState({}, "", "/admin/users/userform");
|
31
|
+
// // Trigger React's routing logic manually if required
|
32
|
+
// const navEvent = new PopStateEvent("popstate");
|
33
|
+
// window.dispatchEvent(navEvent);
|
34
|
+
// };
|
35
35
|
const [currentPage, setCurrentPage] = useState(1);
|
36
36
|
const itemsPerPage = 10;
|
37
37
|
const totalPages = Math.ceil(users.length / itemsPerPage);
|
package/package.json
CHANGED
@@ -4,7 +4,10 @@ import { useState, useEffect } from "react";
|
|
4
4
|
import { FaPlus } from "react-icons/fa";
|
5
5
|
|
6
6
|
import { fetchUsersApi, deleteUserApi } from "../api/user";
|
7
|
-
|
7
|
+
interface UserProps {
|
8
|
+
handleNav: () => void;
|
9
|
+
}
|
10
|
+
function Users({ handleNav }: UserProps) {
|
8
11
|
const [users, setUsers] = useState<any[]>([]);
|
9
12
|
|
10
13
|
const fetchUsersData = async () => {
|
@@ -19,14 +22,14 @@ function Users() {
|
|
19
22
|
useEffect(() => {
|
20
23
|
fetchUsersData();
|
21
24
|
}, []);
|
22
|
-
const handleNav = (e: React.FormEvent) => {
|
23
|
-
|
24
|
-
|
25
|
+
// const handleNav = (e: React.FormEvent) => {
|
26
|
+
// e.preventDefault();
|
27
|
+
// window.history.pushState({}, "", "/admin/users/userform");
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
};
|
29
|
+
// // Trigger React's routing logic manually if required
|
30
|
+
// const navEvent = new PopStateEvent("popstate");
|
31
|
+
// window.dispatchEvent(navEvent);
|
32
|
+
// };
|
30
33
|
|
31
34
|
const [currentPage, setCurrentPage] = useState(1);
|
32
35
|
const itemsPerPage = 10;
|