From fd86644e82a129d29799530365f72f0c60bea7d0 Mon Sep 17 00:00:00 2001 From: Zyxw003 Date: Sun, 19 Jul 2026 18:45:08 +0530 Subject: [PATCH 1/2] coderabbit --- .gitignore | 1 + package-lock.json | 42 ------------------------------------------ 2 files changed, 1 insertion(+), 42 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/package-lock.json b/package-lock.json index 5f72f62..999d12d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -656,9 +656,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -675,9 +672,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -694,9 +688,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -713,9 +704,6 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -732,9 +720,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -751,9 +736,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -960,9 +942,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -979,9 +958,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -998,9 +974,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1017,9 +990,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2580,9 +2550,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -2603,9 +2570,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -2626,9 +2590,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -2649,9 +2610,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ From 61315b20a4041e10a68281ae674d0d3721e41d73 Mon Sep 17 00:00:00 2001 From: Zyxw003 Date: Wed, 26 Aug 2026 09:04:54 +0530 Subject: [PATCH 2/2] backend is completed --- .env | 1 + package-lock.json | 10 +++++----- package.json | 2 +- src/api.ts | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 .env create mode 100644 src/api.ts diff --git a/.env b/.env new file mode 100644 index 0000000..be558b7 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_BACKEND_URL=http://localhost:5000 || ""; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 999d12d..e69fa83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "dependencies": { "@tailwindcss/vite": "^4.3.1", - "axios": "^1.18.0", + "axios": "^1.19.0", "lucide-react": "^1.21.0", "react": "^19.2.7", "react-dom": "^19.2.7", @@ -1463,13 +1463,13 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.0.tgz", - "integrity": "sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.19.0.tgz", + "integrity": "sha512-ht/iuYZXEjFxLH/Hkezgd7m6JKlHHXEUSneaDz8uZe1Gj5QZtCnpyDsckvAiEnT89OEbCLmnte4R4sn7P0EKFw==", "license": "MIT", "dependencies": { "follow-redirects": "^1.16.0", - "form-data": "^4.0.5", + "form-data": "^4.0.6", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^2.1.0" } diff --git a/package.json b/package.json index c351e95..dd3eaa5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@tailwindcss/vite": "^4.3.1", - "axios": "^1.18.0", + "axios": "^1.19.0", "lucide-react": "^1.21.0", "react": "^19.2.7", "react-dom": "^19.2.7", diff --git a/src/api.ts b/src/api.ts new file mode 100644 index 0000000..b478cdd --- /dev/null +++ b/src/api.ts @@ -0,0 +1,40 @@ +import axios from "axios"; +import { error } from "console"; +import { config } from "process"; + +const BACKEND_URL = import.meta.env.VITE_BACKEND_URL; + +const api = axios.create({ + baseURL: BACKEND_URL, + headers: { + "Content-Type": "application/json", + }, +}); + +//request interceptor-token irntha attach pannum + +api.interceptors.request.use( + (config) => { + const token = localStorage.getItem("token"); + if (token) { + config.headers.Authorization = `Bearer${token}`; + } + return config; + }, + (error) => Promise.reject(error), +); + +// Response interceptor-common error handling + +api.interceptors.request.use( + (response) => response, + (error) => { + if (error.response.status === 400) { + // token expire aayiducha,logout logic ingayum podalam + localStorage.removeItem("token"); + } + return Promise.reject(error); + }, +); + +export default api;