diff --git a/src/electron/api/axiosClient.ts b/src/electron/api/axiosClient.ts index 148f750..2be32f0 100644 --- a/src/electron/api/axiosClient.ts +++ b/src/electron/api/axiosClient.ts @@ -13,7 +13,8 @@ const httpsAgent = new https.Agent({ const api: AxiosInstance = axios.create({ // https://dreadingly-unfighting-pandora.ngrok-free.dev/ - baseURL: 'https://daniela-nonprofessed-boastfully.ngrok-free.app/api/v1/va', // 🔁 your backend + // https://quality-friendly-goldfish.ngrok-free.app/ + baseURL: 'https://quality-friendly-goldfish.ngrok-free.app/api/v1/va', // 🔁 your backend httpsAgent // timeout: 10000, }); @@ -39,17 +40,17 @@ api.interceptors.request.use( ); // --- Response Interceptor --- -api.interceptors.response.use( - (response: AxiosResponse) => response.data, - async (error) => { - console.error('[Axios Error]', error.status); - if (error.status === 401 || 403) { - console.warn('Token expired — trigger refresh logic if needed'); - // sendTokenExpired(); - } - return Promise.reject(error); - } -); +// api.interceptors.response.use( +// (response: AxiosResponse) => response.data, +// async (error) => { +// console.error('[Axios Error]', error.status); +// if (error.status === 401 || 403) { +// console.warn('Token expired — trigger refresh logic if needed'); +// // sendTokenExpired(); +// } +// return Promise.reject(error); +// } +// ); api.interceptors.response.use( (response: AxiosResponse) => response.data, diff --git a/src/electron/utils/utilityFunctions.ts b/src/electron/utils/utilityFunctions.ts index 0a15c7d..c09a7ab 100644 --- a/src/electron/utils/utilityFunctions.ts +++ b/src/electron/utils/utilityFunctions.ts @@ -68,7 +68,7 @@ export const handleLogin = async (credentials: { email: string, password: string try { console.log("➡️ Calling API..."); const response = await axios.post( - 'https://daniela-nonprofessed-boastfully.ngrok-free.app/api/v1/va/login', + 'https://quality-friendly-goldfish.ngrok-free.app/api/v1/va/login', { userDetails: { ...credentials } }, { headers: { "ngrok-skip-browser-warning": 69420 }, httpsAgent } ); diff --git a/src/ui/layout/DashboardLayout.tsx b/src/ui/layout/DashboardLayout.tsx index 46d39d8..1359372 100644 --- a/src/ui/layout/DashboardLayout.tsx +++ b/src/ui/layout/DashboardLayout.tsx @@ -588,7 +588,7 @@ const DashboardLayout = () => { if (!selectedProject?.projectId) return console.log(selectedProject?.projectId, "SelectedProject ID") - socketRef.current = io("https://daniela-nonprofessed-boastfully.ngrok-free.app", { + socketRef.current = io("https://quality-friendly-goldfish.ngrok-free.app", { transports: ["websocket"], secure: true, rejectUnauthorized: false, diff --git a/src/ui/pages/Vpn/VpnGuard.tsx b/src/ui/pages/Vpn/VpnGuard.tsx new file mode 100644 index 0000000..5032cb9 --- /dev/null +++ b/src/ui/pages/Vpn/VpnGuard.tsx @@ -0,0 +1,54 @@ +import React, { useEffect, useState } from "react"; + +interface Props { + children: React.ReactNode; +} + +const VpnGuard: React.FC = ({ children }) => { + const [checking, setChecking] = useState(true); + const [vpnConnected, setVpnConnected] = useState(true); + +// const checkVPN = async () => { +// try { +// const res = await window.electron.checkVpnConnection(); +// setVpnConnected(res?.success); +// } catch { +// setVpnConnected(false); +// } finally { +// setChecking(false); +// } +// }; + + useEffect(() => { + // checkVPN(); + }, []); + + if (checking) { + return ( +
+ + Checking VPN... +
+ ); + } + + if (!vpnConnected) { + return ( +
+
+

VPN Required

+

Please connect to your company VPN to continue.

+ + +
+
+ ); + } + + return <>{children}; +}; + +export default VpnGuard;