+
- handleSearch(e.target.value)}
- InputProps={{
- disableUnderline: true,
+ option.name}
+ inputValue={inputValue}
+ className="!w-full"
+ onInputChange={(event, newInputValue) => {
+ setInputValue(newInputValue);
+ handleSearch(newInputValue);
}}
- sx={{
- background: "transparent !important",
- "& .MuiInputBase-root": { height: "100%" },
- "& .MuiInput-root": { borderBottom: "none" },
- "& .MuiInputBase-input": {
- background: "transparent",
- color: "#7E7E7E",
- padding: "0",
- },
+ onChange={(event, newValue) => {
+ setSelectedOption(newValue);
+ handleSearch(newValue ? newValue.name : "");
}}
- placeholder={placeholder}
- dir="rtl"
- className={`!shadow-none !w-full !px-5 !h-full bg-[#FAFAFA] !text-[14px] md:!text-[16px] !min-w-[50%] !rounded-0 !font-normal !text-[#6C757D]`}
+ renderInput={(params) => (
+
+ )}
/>
diff --git a/package-lock.json b/package-lock.json
index 32c29ec..947ff0c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -26,6 +26,7 @@
"i": "^0.3.7",
"jalaali-react-date-picker": "^1.0.18",
"jalali-moment": "^3.3.11",
+ "js-cookie": "^3.0.5",
"next": "^14.2.20",
"next-themes": "^0.3.0",
"npm": "^10.8.2",
@@ -39,8 +40,7 @@
"styled-components": "^6.1.11",
"stylis": "^4.3.4",
"stylis-plugin-rtl": "^2.1.1",
- "swiper": "^11.1.9",
- "universal-cookie": "^7.2.1"
+ "swiper": "^11.1.9"
},
"devDependencies": {
"cross-env": "^7.0.3",
@@ -5409,12 +5409,6 @@
"@types/node": "*"
}
},
- "node_modules/@types/cookie": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
- "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",
- "license": "MIT"
- },
"node_modules/@types/d3-color": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
@@ -8010,15 +8004,6 @@
"integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==",
"license": "MIT"
},
- "node_modules/cookie": {
- "version": "0.7.2",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
- "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.6"
- }
- },
"node_modules/cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
@@ -13594,6 +13579,15 @@
"integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==",
"license": "BSD-3-Clause"
},
+ "node_modules/js-cookie": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
+ "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -22545,16 +22539,6 @@
"node": ">=8"
}
},
- "node_modules/universal-cookie": {
- "version": "7.2.2",
- "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-7.2.2.tgz",
- "integrity": "sha512-fMiOcS3TmzP2x5QV26pIH3mvhexLIT0HmPa3V7Q7knRfT9HG6kTwq02HZGLPw0sAOXrAmotElGRvTLCMbJsvxQ==",
- "license": "MIT",
- "dependencies": {
- "@types/cookie": "^0.6.0",
- "cookie": "^0.7.2"
- }
- },
"node_modules/universalify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
diff --git a/package.json b/package.json
index 86b5e20..4891b64 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
"i": "^0.3.7",
"jalaali-react-date-picker": "^1.0.18",
"jalali-moment": "^3.3.11",
+ "js-cookie": "^3.0.5",
"next": "^14.2.20",
"next-themes": "^0.3.0",
"npm": "^10.8.2",
@@ -40,8 +41,7 @@
"styled-components": "^6.1.11",
"stylis": "^4.3.4",
"stylis-plugin-rtl": "^2.1.1",
- "swiper": "^11.1.9",
- "universal-cookie": "^7.2.1"
+ "swiper": "^11.1.9"
},
"devDependencies": {
"cross-env": "^7.0.3",
diff --git a/services/api.js b/services/api.js
index d250db0..7f2cf92 100644
--- a/services/api.js
+++ b/services/api.js
@@ -1,30 +1,28 @@
import axios from "axios";
-import Cookies from "universal-cookie";
+import Cookies from "js-cookie";
import "react-toastify/dist/ReactToastify.css";
-const cookies = new Cookies();
const BASE_URL = process.env.NEXT_PUBLIC_API_URL;
+const token = Cookies.get("access");
+console.log(token);
+
const api = axios.create({
baseURL: BASE_URL,
headers: {
"Content-Type": "application/json",
- Authorization: `Bearer ${cookies.get("access")}`,
- Cookie:
- "SESS318c6addec00b99e23988eb0e987826b=HpiIBmiGFlESY-f3IhkXEE5sq0mKVT-loNm5TiTN-UstIzn1",
+ Authorization: token ? `Bearer ${token}` : "",
},
});
api.interceptors.response.use(
(response) => {
console.log(response);
-
return response.data;
},
(error) => {
- console.log(error);
-
- return error;
+ console.error(error);
+ return Promise.reject(error);
}
);
diff --git a/services/response.js b/services/response.js
index 3e183b8..4f3e0fa 100644
--- a/services/response.js
+++ b/services/response.js
@@ -25,8 +25,6 @@ export const request = {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "",
withCredentials: true,
- Cookie:
- "SESS318c6addec00b99e23988eb0e987826b=HpiIBmiGFlESY-f3IhkXEE5sq0mKVT-loNm5TiTN-UstIzn1",
},
});
},
diff --git a/utils/index.js b/utils/index.js
index 0ca58f5..b8a53d5 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -1,7 +1,5 @@
-import Cookies from "universal-cookie";
+import Cookies from "js-cookie";
-const cookies = new Cookies();
-
-const removeToken = () => cookies.remove("token", { path: "/" });
+const removeToken = () => Cookies.remove("token", { path: "/" });
export { removeToken };