diff --git a/src/pages/Login.js b/src/pages/Login.js index a020697..039d436 100644 --- a/src/pages/Login.js +++ b/src/pages/Login.js @@ -36,10 +36,13 @@ const Login = () => { if (Object.keys(newErrors).length === 0) { setLoading(true); try { - const response = await axios.post("https://smartserver-production.up.railway.app/login", { - email, - password, - }); + const response = await axios.post( + "https://smartserver-scbe.onrender.com/login", + { + email, + password, + } + ); if (response && response.data.success) { localStorage.setItem("isLoggedIn", "true"); @@ -47,13 +50,11 @@ const Login = () => { // Decode the token to get the user role - const tokenPayload = JSON.parse( atob(response.data.token.split(".")[1]) ); const userRole = tokenPayload.role; - // Store user role in localStorage localStorage.setItem( "currentUser", @@ -87,7 +88,6 @@ const Login = () => { navigate("/"); } }, 2000); - } } catch (error) { if (error.response) { diff --git a/src/pages/Notification.js b/src/pages/Notification.js index 26c898f..4031321 100644 --- a/src/pages/Notification.js +++ b/src/pages/Notification.js @@ -15,7 +15,7 @@ const NotificationSettings = () => { try { const token = localStorage.getItem("token"); const response = await fetch( - "https://smartserver-production.up.railway.app/update-notification", + "https://smartserver-scbe.onrender.com/update-notification", { method: "PUT", headers: { diff --git a/src/pages/QR.js b/src/pages/QR.js index a1bbf29..48b835c 100644 --- a/src/pages/QR.js +++ b/src/pages/QR.js @@ -80,13 +80,13 @@ const QRCodeVerification = () => { setIsScannerOpen(false); try { const response = await axios.post( - `http://localhost:6352/scan-product`, + `https://smartserver-scbe.onrender.com/scan-product`, { barcode: data } ); setProductInfo(response.data.product); // Save the product information to the database if not already present await axios.post( - `http://localhost:6352/add-product`, + `https://smartserver-scbe.onrender.com/add-product`, response.data.product ); } catch (err) { diff --git a/src/pages/Settings.js b/src/pages/Settings.js index 1516490..ea16a21 100644 --- a/src/pages/Settings.js +++ b/src/pages/Settings.js @@ -29,11 +29,14 @@ const Settings = () => { "Are you sure you want to delete your account permanently?" ); if (confirmation) { - const response = await axios.delete("https://smartserver-production.up.railway.app/delete", { - headers: { - Authorization: `Bearer ${localStorage.getItem("token")}`, - }, - }); + const response = await axios.delete( + "https://smartserver-scbe.onrender.com/delete", + { + headers: { + Authorization: `Bearer ${localStorage.getItem("token")}`, + }, + } + ); if (response.status === 200) { setTimeout(() => { diff --git a/src/pages/Signup.js b/src/pages/Signup.js index 23ba278..e019ba8 100644 --- a/src/pages/Signup.js +++ b/src/pages/Signup.js @@ -52,7 +52,7 @@ const SignUp = () => { setLoading(true); try { const response = await axios.post( - "https://smartserver-production.up.railway.app/signup", + "https://smartserver-scbe.onrender.com/signup", { name: username, email, diff --git a/src/settings/AccountSettings.js b/src/settings/AccountSettings.js index 0a75418..07ebd5d 100644 --- a/src/settings/AccountSettings.js +++ b/src/settings/AccountSettings.js @@ -34,7 +34,7 @@ const AccountSettings = () => { try { const token = localStorage.getItem("token"); const response = await axios.put( - "https://smartserver-production.up.railway.app/settings/account", + "https://smartserver-scbe.onrender.com/settings/account", { email, password,