| 1 |
/** |
| 2 |
* Frontend Account Page Entry Point |
| 3 |
* Loads the customer account page on the frontend |
| 4 |
*/ |
| 5 |
|
| 6 |
import React from "react"; |
| 7 |
import ReactDOM from "react-dom/client"; |
| 8 |
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; |
| 9 |
import AccountPage from "./pages/AccountPage"; |
| 10 |
import { ToastProvider } from "./components/ui/toast"; |
| 11 |
import "./css/index.css"; |
| 12 |
|
| 13 |
// Create React Query client |
| 14 |
const queryClient = new QueryClient({ |
| 15 |
defaultOptions: { |
| 16 |
queries: { |
| 17 |
refetchOnWindowFocus: false, |
| 18 |
retry: 1, |
| 19 |
staleTime: 5 * 60 * 1000, // 5 minutes |
| 20 |
}, |
| 21 |
}, |
| 22 |
}); |
| 23 |
|
| 24 |
// Get mount point |
| 25 |
const rootElement = document.getElementById("yatra-account-page-root"); |
| 26 |
|
| 27 |
if (rootElement) { |
| 28 |
try { |
| 29 |
const root = ReactDOM.createRoot(rootElement); |
| 30 |
|
| 31 |
root.render( |
| 32 |
<React.StrictMode> |
| 33 |
<QueryClientProvider client={queryClient}> |
| 34 |
<ToastProvider> |
| 35 |
<AccountPage /> |
| 36 |
</ToastProvider> |
| 37 |
</QueryClientProvider> |
| 38 |
</React.StrictMode>, |
| 39 |
); |
| 40 |
} catch (error) { |
| 41 |
console.error("Error rendering account page:", error); |
| 42 |
rootElement.innerHTML = |
| 43 |
'<div style="padding: 40px; text-align: center;"><h2>Error loading account page</h2><p>Please refresh the page or contact support.</p></div>'; |
| 44 |
} |
| 45 |
} |
| 46 |
|