diff --git a/api-dashboard/src/App.tsx b/api-dashboard/src/App.tsx index ae5900db..fade568b 100644 --- a/api-dashboard/src/App.tsx +++ b/api-dashboard/src/App.tsx @@ -27,9 +27,7 @@ interface UserSession { roleOrType: string; } -const BACKEND_URL = window.location.origin.includes('localhost') - ? 'http://localhost:8080' - : window.location.origin; +const BACKEND_URL = 'https://cmsapi.rit-services.in'; function App() { // Auth State diff --git a/backend/src/main/java/com/rit/canteen/sales/config/SecurityConfig.java b/backend/src/main/java/com/rit/canteen/sales/config/SecurityConfig.java index 69591311..fde43c36 100644 --- a/backend/src/main/java/com/rit/canteen/sales/config/SecurityConfig.java +++ b/backend/src/main/java/com/rit/canteen/sales/config/SecurityConfig.java @@ -120,6 +120,7 @@ public class SecurityConfig { List origins = Arrays.asList(allowedOriginsStr.split(",")); configuration.setAllowedOrigins(origins); configuration.setAllowedOriginPatterns(List.of( + "*", "http://localhost:*", "http://127.0.0.1:*", "http://192.168.*:*", diff --git a/backend/src/main/java/com/rit/canteen/sales/service/DatabaseSeeder.java b/backend/src/main/java/com/rit/canteen/sales/service/DatabaseSeeder.java index 982dc7a5..b3d3c982 100644 --- a/backend/src/main/java/com/rit/canteen/sales/service/DatabaseSeeder.java +++ b/backend/src/main/java/com/rit/canteen/sales/service/DatabaseSeeder.java @@ -316,14 +316,7 @@ public class DatabaseSeeder implements CommandLineRunner { systemUserRepository.save(admin); System.out.println(">>> SEEDED ADMIN MASTER USER (username: " + targetUsername + ")"); } else { - SystemUser admin = existingAdmin.get(); - admin.setPassword(passwordEncoder.encode(targetPassword)); - admin.setRole("MASTER"); - if (admin.getPermissions() == null || admin.getPermissions().isEmpty()) { - admin.setPermissions(List.of("dashboard", "sale", "customers", "purchases", "inventory", "expense", "reports", "stores", "table", "wallet", "promotions", "feedback")); - } - systemUserRepository.save(admin); - System.out.println(">>> VERIFIED & UPDATED ADMIN MASTER USER credentials for: " + targetUsername); + System.out.println(">>> ADMIN MASTER USER already exists. Skipping overwrite."); } } } diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 51318e13..2d61b41b 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -6,9 +6,9 @@ server.port=8080 # DATABASE — REQUIRED environment variables # Set these in your environment or a .env file # ============================================================ -spring.datasource.url=jdbc:postgresql://localhost:5432/positeasy +spring.datasource.url=jdbc:postgresql://localhost:5432/rit_cms spring.datasource.username=postgres -spring.datasource.password=sidharth +spring.datasource.password=RITHosting123 spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.hibernate.ddl-auto=update diff --git a/counter-frontend/src/pages/Categories.tsx b/counter-frontend/src/pages/Categories.tsx index 91f4ba48..5c111dbb 100644 --- a/counter-frontend/src/pages/Categories.tsx +++ b/counter-frontend/src/pages/Categories.tsx @@ -18,7 +18,8 @@ const apiFetch = async (url: string, options: RequestInit = {}) => { ...(options.headers || {}), ...(token ? { 'Authorization': `Bearer ${token}` } : {}) }; - const response = await fetch(url, { ...options, headers }); + const cleanUrl = url.replace(/^http:\/\/[^:/]+:8080\/api/, 'https://cmsapi.rit-services.in/api'); + const response = await fetch(cleanUrl, { ...options, headers }); if (response.status === 401 || response.status === 403) { sessionStorage.removeItem('isCounterLoggedIn'); sessionStorage.removeItem('counterToken'); diff --git a/counter-frontend/src/pages/Login.tsx b/counter-frontend/src/pages/Login.tsx index effcb4f7..eaff733e 100644 --- a/counter-frontend/src/pages/Login.tsx +++ b/counter-frontend/src/pages/Login.tsx @@ -27,7 +27,7 @@ const Login = () => { try { const host = window.location.hostname; - const response = await fetch(`http://${host}:8080/api/system/login`, { + const response = await fetch(`https://cmsapi.rit-services.in/api/system/login`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: username, password }) diff --git a/counter-frontend/src/pages/Orders.tsx b/counter-frontend/src/pages/Orders.tsx index 59d77025..b9b4d0d6 100644 --- a/counter-frontend/src/pages/Orders.tsx +++ b/counter-frontend/src/pages/Orders.tsx @@ -61,7 +61,8 @@ const apiFetch = async (url: string, options: RequestInit = {}) => { ...(options.headers || {}), ...(token ? { 'Authorization': `Bearer ${token}` } : {}) }; - const response = await fetch(url, { ...options, headers }); + const cleanUrl = url.replace(/^http:\/\/[^:/]+:8080\/api/, 'https://cmsapi.rit-services.in/api'); + const response = await fetch(cleanUrl, { ...options, headers }); if (response.status === 401 || response.status === 403) { sessionStorage.removeItem('isCounterLoggedIn'); sessionStorage.removeItem('counterToken'); diff --git a/counter-frontend/src/pages/POS.tsx b/counter-frontend/src/pages/POS.tsx index cdd98200..0c31d621 100644 --- a/counter-frontend/src/pages/POS.tsx +++ b/counter-frontend/src/pages/POS.tsx @@ -49,10 +49,9 @@ const POS = () => { const fetchInitialData = async () => { try { setLoading(true); - const host = window.location.hostname; const [prodRes, catRes] = await Promise.all([ - fetch(`http://${host}:8080/api/products?size=1000`), - fetch(`http://${host}:8080/api/products/categories`) + fetch(`https://cmsapi.rit-services.in/api/products?size=1000`), + fetch(`https://cmsapi.rit-services.in/api/products/categories`) ]); if (prodRes.ok) { @@ -114,7 +113,6 @@ const POS = () => { setLoading(true); try { - const host = window.location.hostname; const orderData = { userId: 1, // Using test user ID totalAmount: total, @@ -129,7 +127,7 @@ const POS = () => { }; const token = sessionStorage.getItem('counterToken'); - const response = await fetch(`http://${host}:8080/api/orders`, { + const response = await fetch(`https://cmsapi.rit-services.in/api/orders`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/counter-frontend/src/pages/Products.tsx b/counter-frontend/src/pages/Products.tsx index e9ddc3c2..8a5b6ff5 100644 --- a/counter-frontend/src/pages/Products.tsx +++ b/counter-frontend/src/pages/Products.tsx @@ -86,7 +86,8 @@ const apiFetch = async (url: string, options: RequestInit = {}) => { ...(options.headers || {}), ...(token ? { 'Authorization': `Bearer ${token}` } : {}) }; - const response = await fetch(url, { ...options, headers }); + const cleanUrl = url.replace(/^http:\/\/[^:/]+:8080\/api/, 'https://cmsapi.rit-services.in/api'); + const response = await fetch(cleanUrl, { ...options, headers }); if (response.status === 401 || response.status === 403) { sessionStorage.removeItem('isCounterLoggedIn'); sessionStorage.removeItem('counterToken'); diff --git a/frontend/index.html b/frontend/index.html index c12dcb8d..996f4fcd 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,6 +2,10 @@ + Tillo Canteen Dashboard diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 93e7c01e..ae10d6c5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -755,9 +755,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -775,9 +772,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -795,9 +789,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -815,9 +806,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -835,9 +823,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -855,9 +840,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1591,16 +1573,16 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", - "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" }, "engines": { - "node": "18 || 20 || >=22" + "node": "20 || >=22" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { @@ -1844,9 +1826,9 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "license": "MIT", "dependencies": { @@ -2229,9 +2211,9 @@ } }, "node_modules/dompurify": { - "version": "3.4.10", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.10.tgz", - "integrity": "sha512-0xzNv0e7oYC6yyuOGZIABPM4qtg3QxLFniDNPP4ZP90wR8Yq3zgwpRbrNiT4N3IKqDbbYFEJLV+JWEs19aZ//w==", + "version": "3.4.12", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.12.tgz", + "integrity": "sha512-zQvGet8Z2sWbQhCmfFz/T5QWH2oBmjnqK3qvOjaqaNLrLEF912WamU+ohnTp0TCep/MFVHpdJuCZEdFOdTnEFg==", "license": "(MPL-2.0 OR Apache-2.0)", "optional": true, "optionalDependencies": { @@ -2839,9 +2821,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "dev": true, "funding": [ { @@ -3307,9 +3289,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.12", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", - "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", "dev": true, "funding": [ { @@ -3456,9 +3438,9 @@ } }, "node_modules/postcss": { - "version": "8.5.15", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", - "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "version": "8.5.25", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz", + "integrity": "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==", "dev": true, "funding": [ { @@ -3476,7 +3458,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.12", + "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3582,9 +3564,9 @@ } }, "node_modules/react-router": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.0.tgz", - "integrity": "sha512-pTTGt8J+ji1NOmYnjzT+bAJy/1zD+Jp4ziO6cL7T3ZLvXKtusO7BpFqlRXitqpcPVqllsIXFHRMt+2/k3Xn6HQ==", + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.2.tgz", + "integrity": "sha512-aUVMjFm3GAPTTZL7oYr5E7ETiqfQCHRLH+B+5afnICvf0r7kkK4eR6SMuwbSTJw/7t+12khT/Kahij49fqOCIg==", "license": "MIT", "dependencies": { "cookie": "^1.0.1", @@ -3604,12 +3586,12 @@ } }, "node_modules/react-router-dom": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.0.tgz", - "integrity": "sha512-Fi0yY6kgtKae/Th2xibdWK0KSdYZ4B53Gyf6wRtomOKWgpNm7H7+DyfDhncdz9FKbpS+1jmDhg3F4WoGJ+yFOA==", + "version": "7.18.2", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.2.tgz", + "integrity": "sha512-AIKJ/jgGlFb3EbfCXk5Gzshiwt+l3mqbCrNjmEWMMjqQxNJ3svBa6bgzFyCC2Sw3RA0VWF1kg3uQf2OFhxb8hw==", "license": "MIT", "dependencies": { - "react-router": "7.18.0" + "react-router": "7.18.2" }, "engines": { "node": ">=20.0.0" diff --git a/frontend/src/api.ts b/frontend/src/api.ts index c7e0296a..26aa6b03 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -38,7 +38,16 @@ export async function apiFetch(url: string, options: RequestInit = {}): Promise< headers['Authorization'] = `Bearer ${token}`; } - const response = await fetch(url, { ...options, headers }); + // Normalize/Rewrite the URL to point to cmsapi.rit-services.in + let cleanUrl = url; + if (url.startsWith('/api')) { + cleanUrl = `https://cmsapi.rit-services.in${url}`; + } else { + // Replace any localhost or host with 8080 to the real CMS API server + cleanUrl = url.replace(/^http:\/\/(localhost|[^:/]+):8080\/api/, 'https://cmsapi.rit-services.in/api'); + } + + const response = await fetch(cleanUrl, { ...options, headers }); if (response.status === 401 || response.status === 403) { // Token expired or invalid — redirect to login diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 9b59a691..0d766bef 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -35,7 +35,7 @@ const Login = () => { e.preventDefault(); try { - const response = await fetch('/api/system/login', { + const response = await fetch('https://cmsapi.rit-services.in/api/system/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email: username, password }) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 39636c83..9dfe0dcb 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -5,11 +5,14 @@ import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [react()], server: { - port: 5175, host: true, + port: 5175, + allowedHosts: [ + 'cmsadmin.rit-services.in' + ], proxy: { '/api': { - target: 'http://localhost:8080', + target: 'https://cmsapi.rit-services.in', changeOrigin: true, secure: false, } diff --git a/ordering_site/package-lock.json b/ordering_site/package-lock.json index bd1cb089..e51861a3 100644 --- a/ordering_site/package-lock.json +++ b/ordering_site/package-lock.json @@ -14,7 +14,7 @@ "qrcode.react": "^4.2.0", "react": "^19.2.4", "react-dom": "^19.2.4", - "react-router-dom": "^7.14.0" + "react-router-dom": "^7.11.0" }, "devDependencies": { "@eslint/js": "^9.39.4", @@ -1386,9 +1386,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1406,9 +1403,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1426,9 +1420,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1446,9 +1437,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1466,9 +1454,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1486,9 +1471,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1828,16 +1810,16 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", - "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" }, "engines": { - "node": "18 || 20 || >=22" + "node": "20 || >=22" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { @@ -2042,9 +2024,9 @@ } }, "node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", + "integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "dev": true, "license": "MIT", "dependencies": { @@ -2817,9 +2799,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "dev": true, "funding": [ { @@ -3053,9 +3035,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3077,9 +3056,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3101,9 +3077,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3125,9 +3098,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -3273,9 +3243,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.12", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", - "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", "dev": true, "funding": [ { @@ -3412,9 +3382,9 @@ } }, "node_modules/postcss": { - "version": "8.5.15", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", - "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "version": "8.5.25", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz", + "integrity": "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==", "dev": true, "funding": [ { @@ -3432,7 +3402,7 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.12", + "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, @@ -3520,9 +3490,9 @@ } }, "node_modules/react-router": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.0.tgz", - "integrity": "sha512-pTTGt8J+ji1NOmYnjzT+bAJy/1zD+Jp4ziO6cL7T3ZLvXKtusO7BpFqlRXitqpcPVqllsIXFHRMt+2/k3Xn6HQ==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.11.0.tgz", + "integrity": "sha512-uI4JkMmjbWCZc01WVP2cH7ZfSzH91JAZUDd7/nIprDgWxBV1TkkmLToFh7EbMTcMak8URFRa2YoBL/W8GWnCTQ==", "license": "MIT", "dependencies": { "cookie": "^1.0.1", @@ -3542,12 +3512,12 @@ } }, "node_modules/react-router-dom": { - "version": "7.18.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.0.tgz", - "integrity": "sha512-Fi0yY6kgtKae/Th2xibdWK0KSdYZ4B53Gyf6wRtomOKWgpNm7H7+DyfDhncdz9FKbpS+1jmDhg3F4WoGJ+yFOA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.11.0.tgz", + "integrity": "sha512-e49Ir/kMGRzFOOrYQBdoitq3ULigw4lKbAyKusnvtDu2t4dBX4AGYPrzNvorXmVuOyeakai6FUPW5MmibvVG8g==", "license": "MIT", "dependencies": { - "react-router": "7.18.0" + "react-router": "7.11.0" }, "engines": { "node": ">=20.0.0" diff --git a/ordering_site/package.json b/ordering_site/package.json index 894a8516..21b25657 100644 --- a/ordering_site/package.json +++ b/ordering_site/package.json @@ -16,7 +16,7 @@ "qrcode.react": "^4.2.0", "react": "^19.2.4", "react-dom": "^19.2.4", - "react-router-dom": "^7.14.0" + "react-router-dom": "^7.11.0" }, "devDependencies": { "@eslint/js": "^9.39.4", diff --git a/ordering_site/src/contexts/AuthContext.tsx b/ordering_site/src/contexts/AuthContext.tsx index c90816df..1a6dcfc3 100644 --- a/ordering_site/src/contexts/AuthContext.tsx +++ b/ordering_site/src/contexts/AuthContext.tsx @@ -17,7 +17,7 @@ interface AuthContextType { const AuthContext = createContext(undefined); -const API_BASE_URL = `http://${window.location.hostname}:8080/api/auth`; +const API_BASE_URL = 'https://cmsapi.rit-services.in/api/auth'; export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { const [user, setUser] = useState(null); diff --git a/ordering_site/src/contexts/FoodContext.tsx b/ordering_site/src/contexts/FoodContext.tsx index 660cc9ba..f0466c32 100644 --- a/ordering_site/src/contexts/FoodContext.tsx +++ b/ordering_site/src/contexts/FoodContext.tsx @@ -12,7 +12,7 @@ interface FoodContextType { const FoodContext = createContext(undefined); -const API_BASE_URL = `http://${window.location.hostname}:8080/api`; +const API_BASE_URL = 'https://cmsapi.rit-services.in/api'; const EMOJIS = ['🍦', '🍪', '🧃', '🍫', '🥨', '🥐', '🍹', '📦', '🍳', '🍱', '🍔', '🍕', '🥗', '🍲']; const COLORS = ['#FFF0F6', '#FFF7ED', '#FFFFEB', '#FDF3EF', '#F0FDF4', '#FEFCE8', '#EFF6FF']; diff --git a/ordering_site/vite.config.ts b/ordering_site/vite.config.ts index 92d035c7..880f2d17 100644 --- a/ordering_site/vite.config.ts +++ b/ordering_site/vite.config.ts @@ -1,11 +1,12 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' -// https://vite.dev/config/ export default defineConfig({ plugins: [react()], server: { port: 5173, - host: true, // Allow network access + host: true, + allowedHosts: true, + hmr: false, }, })