Skip to content

Commit

Permalink
add rollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatyana-js committed Feb 5, 2025
1 parent 70f413b commit e3464f5
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 185 deletions.
21 changes: 21 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@reduxjs/toolkit": "^2.4.0",
"@rollbar/react": "^0.12.0-beta",
"@vitejs/plugin-react": "^4.3.4",
"axios": "^1.7.9",
"bootstrap": "^5.3.3",
Expand Down
35 changes: 19 additions & 16 deletions frontend/src/init.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import i18next from 'i18next';
import { ToastContainer } from 'react-toastify';
import { combineReducers, configureStore } from '@reduxjs/toolkit';
import * as filter from 'leo-profanity';
// import { ErrorBoundary } from '@rollbar/react';
import { Provider as RollbarProvider, ErrorBoundary } from '@rollbar/react';
import { chatApi } from './api/chatApi.js';
import activeChannelReducer from './slices/activeChannelSlice.js';
import modalsReducer from './slices/modalsSlice.js';
Expand Down Expand Up @@ -61,25 +61,28 @@ const init = async () => {
draft.push({ payload });
}));
});
// const rollbarConfig = {
// accessToken: import.meta.env.VITE_ROLLBAR_ACCESS_TOKEN,
// environment: import.meta.env.MODE,
// };

const rollbarConfig = {
accessToken: '',
environment: 'testenv',
};

filter.add(filter.getDictionary('en'));
filter.add(filter.getDictionary('ru'));

return (
// <ErrorBoundary fallback={rollbarConfig}>
<I18nextProvider i18n={i18n}>
<Provider store={store}>
<StrictMode>
<App />
<ToastContainer />
</StrictMode>
</Provider>
</I18nextProvider>
// </ErrorBoundary>

<RollbarProvider config={rollbarConfig}>
<I18nextProvider i18n={i18n}>
<ErrorBoundary>
<Provider store={store}>
<StrictMode>
<App />
<ToastContainer />
</StrictMode>
</Provider>
</ErrorBoundary>
</I18nextProvider>
</RollbarProvider>
);
};

Expand Down
2 changes: 0 additions & 2 deletions frontend/src/pages/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useTranslation } from 'react-i18next';
import avatarLogin from '../assets/avatarLogin.jpg';
import useAuth from '../hooks/index.jsx';
import router from '../utils/routes.js';
import { toast } from 'react-toastify';

const LoginPage = () => {
const auth = useAuth();
Expand All @@ -32,7 +31,6 @@ const LoginPage = () => {
if (axios.isAxiosError(err) && err.response.status === 401) {
setAuthFailed(true);
inputEl.current.select();
toast.error(t('errors.axiosError'));
return;
}
throw err;
Expand Down
Loading

0 comments on commit e3464f5

Please sign in to comment.