Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjsjsj1246 committed Nov 4, 2023
2 parents 03ef1b9 + 6e70e4d commit d2603c4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
42 changes: 22 additions & 20 deletions src/initializeApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,30 @@ import { createBrowserHistory } from 'history';
import { enableMapSet } from 'immer';
import airbridge from 'airbridge-web-sdk-loader';

enableMapSet();
export default function initializeApp() {
enableMapSet();

if (import.meta.env.PROD) {
// GA 관련 초기화
ReactGA.initialize(import.meta.env.VITE_GA_TRACKING_ID, { gaOptions: {} });
if (import.meta.env.PROD) {
// GA 관련 초기화
ReactGA.initialize(import.meta.env.VITE_GA_TRACKING_ID, { gaOptions: {} });

const history = createBrowserHistory();
history.listen(async (response) => {
ReactGA.send({ hitType: 'pageview', page: response.location.pathname });
});

// Pixel 관련 초기화
import('react-facebook-pixel')
.then((module) => module.default)
.then((ReactPixel) => {
ReactPixel.init(import.meta.env.VITE_PIXEL_ID);
ReactPixel.pageView();
const history = createBrowserHistory();
history.listen(async (response) => {
ReactGA.send({ hitType: 'pageview', page: response.location.pathname });
});

// Airbridge 관련 초기화
airbridge.init({
app: import.meta.env.VITE_AIRBRIDGE_NAME,
webToken: import.meta.env.VITE_AIRBRIDGE_WEB_TOKEN,
});
// Pixel 관련 초기화
import('react-facebook-pixel')
.then((module) => module.default)
.then((ReactPixel) => {
ReactPixel.init(import.meta.env.VITE_PIXEL_ID);
ReactPixel.pageView();
});

// Airbridge 관련 초기화
airbridge.init({
app: import.meta.env.VITE_AIRBRIDGE_NAME,
webToken: import.meta.env.VITE_AIRBRIDGE_WEB_TOKEN,
});
}
}
5 changes: 3 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { Toaster } from 'react-hot-toast';
import App from 'App';
import './index.css';
import initializeApp from './initializeApp';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -14,10 +14,11 @@ const queryClient = new QueryClient({
},
});

initializeApp();

const container = document.getElementById('root') as HTMLElement;
const element = (
<QueryClientProvider client={queryClient}>
<ReactQueryDevtools />
<BrowserRouter>
<App />
<Toaster position="bottom-center" containerClassName="toaster" />
Expand Down

0 comments on commit d2603c4

Please sign in to comment.