Skip to content

Commit

Permalink
Merge pull request #656 from oraichain/fix/block-cors
Browse files Browse the repository at this point in the history
fix: block cors rpc
  • Loading branch information
haunv3 authored Feb 29, 2024
2 parents 6f8164b + dbb7508 commit d3ec79e
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import mixpanel from 'mixpanel-browser';
import './index.scss';
import App from './layouts/App';
import ScrollToTop from './layouts/ScrollToTop';
import { handleErrorTransaction } from 'helper';

const queryClient = new QueryClient();

Expand Down Expand Up @@ -42,27 +43,31 @@ if (process.env.REACT_APP_SENTRY_ENVIRONMENT === 'production') {
}

const initApp = async () => {
// @ts-ignore
window.client = await SigningCosmWasmClient.connect(network.rpc);

const root = createRoot(document.getElementById('oraiswap'));
root.render(
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<ToastProvider>
<Router>
<ScrollToTop />
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</Router>
<ToastContext.Consumer>
{(value) => <ToastContainer transition={Bounce} toastClassName={value.theme} />}
</ToastContext.Consumer>
</ToastProvider>
</PersistGate>
</Provider>
);
try {
// @ts-ignore
window.client = await SigningCosmWasmClient.connect(network.rpc);
} catch (error) {
handleErrorTransaction(error);
} finally {
const root = createRoot(document.getElementById('oraiswap'));
root.render(
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<ToastProvider>
<Router>
<ScrollToTop />
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</Router>
<ToastContext.Consumer>
{(value) => <ToastContainer transition={Bounce} toastClassName={value.theme} />}
</ToastContext.Consumer>
</ToastProvider>
</PersistGate>
</Provider>
);
}
};

initApp();

0 comments on commit d3ec79e

Please sign in to comment.