BankliPlus/temparea/solarbank/frontend/node_modules/.cache/babel-loader/3c076cf4e2481a6bc1a17d61e7da2ba011dd67f72a5e45392235114ef4cf0391.json
2025-08-13 18:05:26 +02:00

1 line
2.5 KiB
JSON

{"ast":null,"code":"import React from'react';import{Navigate}from'react-router-dom';import{useAuth}from'../contexts/AuthContext';import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";const ProtectedRoute=_ref=>{let{children}=_ref;const{isAuthenticated,loading}=useAuth();if(loading){return/*#__PURE__*/_jsx(\"div\",{className:\"min-h-screen bg-gray-50 flex items-center justify-center\",children:/*#__PURE__*/_jsxs(\"div\",{className:\"text-center\",children:[/*#__PURE__*/_jsx(\"div\",{className:\"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto\"}),/*#__PURE__*/_jsx(\"p\",{className:\"mt-4 text-gray-600\",children:\"Loading...\"})]})});}return isAuthenticated?children:/*#__PURE__*/_jsx(Navigate,{to:\"/login\",replace:true});};export default ProtectedRoute;","map":{"version":3,"names":["React","Navigate","useAuth","jsx","_jsx","jsxs","_jsxs","ProtectedRoute","_ref","children","isAuthenticated","loading","className","to","replace"],"sources":["/home/m3mo/Desktop/temparea/solarbank/frontend/src/components/ProtectedRoute.js"],"sourcesContent":["import React from 'react';\nimport { Navigate } from 'react-router-dom';\nimport { useAuth } from '../contexts/AuthContext';\n\nconst ProtectedRoute = ({ children }) => {\n const { isAuthenticated, loading } = useAuth();\n\n if (loading) {\n return (\n <div className=\"min-h-screen bg-gray-50 flex items-center justify-center\">\n <div className=\"text-center\">\n <div className=\"animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto\"></div>\n <p className=\"mt-4 text-gray-600\">Loading...</p>\n </div>\n </div>\n );\n }\n\n return isAuthenticated ? children : <Navigate to=\"/login\" replace />;\n};\n\nexport default ProtectedRoute; "],"mappings":"AAAA,MAAO,CAAAA,KAAK,KAAM,OAAO,CACzB,OAASC,QAAQ,KAAQ,kBAAkB,CAC3C,OAASC,OAAO,KAAQ,yBAAyB,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAElD,KAAM,CAAAC,cAAc,CAAGC,IAAA,EAAkB,IAAjB,CAAEC,QAAS,CAAC,CAAAD,IAAA,CAClC,KAAM,CAAEE,eAAe,CAAEC,OAAQ,CAAC,CAAGT,OAAO,CAAC,CAAC,CAE9C,GAAIS,OAAO,CAAE,CACX,mBACEP,IAAA,QAAKQ,SAAS,CAAC,0DAA0D,CAAAH,QAAA,cACvEH,KAAA,QAAKM,SAAS,CAAC,aAAa,CAAAH,QAAA,eAC1BL,IAAA,QAAKQ,SAAS,CAAC,0EAA0E,CAAM,CAAC,cAChGR,IAAA,MAAGQ,SAAS,CAAC,oBAAoB,CAAAH,QAAA,CAAC,YAAU,CAAG,CAAC,EAC7C,CAAC,CACH,CAAC,CAEV,CAEA,MAAO,CAAAC,eAAe,CAAGD,QAAQ,cAAGL,IAAA,CAACH,QAAQ,EAACY,EAAE,CAAC,QAAQ,CAACC,OAAO,MAAE,CAAC,CACtE,CAAC,CAED,cAAe,CAAAP,cAAc","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}