eleven-solutions-common-website-unique-web 22.0.0 → 22.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
+ import toast from "react-hot-toast";
12
13
  import { addUserApi, updateUserApi, fetchUserByIdApi } from "../api/user";
13
14
  const UserForm = ({ url }) => {
14
15
  const [userName, setUserName] = useState("");
@@ -20,7 +21,7 @@ const UserForm = ({ url }) => {
20
21
  const [isEditMode, setIsEditMode] = useState(false);
21
22
  const validateForm = () => {
22
23
  if (!userName || !roleType) {
23
- alert("Please fill in all required fields: User Name, Email, and Role Type.");
24
+ toast.error("Please fill in all required fields: User Name, Email, and Role Type.");
24
25
  return false;
25
26
  }
26
27
  return true;
@@ -57,18 +58,18 @@ const UserForm = ({ url }) => {
57
58
  try {
58
59
  if (isEditMode) {
59
60
  yield updateUserApi(url, id, userName, email, mobile, address, roleType, gender);
60
- alert("User updated successfully");
61
+ toast.success("User updated successfully");
61
62
  }
62
63
  else {
63
64
  yield addUserApi(url, userName, email, mobile, address, roleType, gender);
64
- alert("User added successfully");
65
+ toast.success("User added successfully");
65
66
  }
66
67
  window.history.pushState({}, "", "/admin/users");
67
68
  window.dispatchEvent(new PopStateEvent("popstate"));
68
69
  }
69
70
  catch (error) {
70
71
  console.error("Error adding/updating User:", error);
71
- alert(isEditMode ? "Failed to Update the User." : "Failed to Add the User.");
72
+ toast.error(isEditMode ? "Failed to Update the User." : "Failed to Add the User.");
72
73
  }
73
74
  });
74
75
  const handleCancelClick = () => {
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
+ import toast from "react-hot-toast";
12
13
  import { FaPlus } from "react-icons/fa";
13
14
  import { fetchUsersApi, deleteUserApi } from "../api/user";
14
15
  const Users = ({ url }) => {
@@ -70,7 +71,7 @@ const Users = ({ url }) => {
70
71
  const handleDeleteClick = (id) => __awaiter(void 0, void 0, void 0, function* () {
71
72
  try {
72
73
  yield deleteUserApi(url, id);
73
- alert("User deleted successfully");
74
+ toast.success("User deleted successfully");
74
75
  fetchUsersData();
75
76
  }
76
77
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "22.0.0",
3
+ "version": "22.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -27,6 +27,7 @@
27
27
  "@reduxjs/toolkit": "^2.3.0",
28
28
  "@tabler/icons-react": "^3.21.0",
29
29
  "jodit-react": "^4.1.2",
30
+ "react-hot-toast": "^2.5.1",
30
31
  "react-icons": "^5.3.0",
31
32
  "react-redux": "^9.1.2",
32
33
  "react-router-dom": "^6.27.0",