Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change code #1

Open
mr-woot opened this issue Jul 22, 2018 · 3 comments
Open

change code #1

mr-woot opened this issue Jul 22, 2018 · 3 comments

Comments

@mr-woot
Copy link
Contributor

mr-woot commented Jul 22, 2018


// import logger from "redux-logger";
import thunk from "redux-thunk";
import promiseMiddleware from "redux-promise-middleware";
import reduxReset from "redux-reset";

import reducer from "./reducers";

const middleware = applyMiddleware(promiseMiddleware(), thunk);
// const middleware = applyMiddleware(promiseMiddleware(), thunk, logger);

export default createStore(reducer,
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
    middleware,
    reduxReset());
@mr-woot
Copy link
Contributor Author

mr-woot commented Jul 22, 2018


import logger from "redux-logger";
import thunk from "redux-thunk";
import promiseMiddleware from "redux-promise-middleware";

import reducer from "./reducers";

// const middleware = applyMiddleware(promiseMiddleware(), thunk);
const middleware = applyMiddleware(promiseMiddleware(), thunk, logger);

export default createStore(reducer,
    middleware);

@mr-woot
Copy link
Contributor Author

mr-woot commented Jul 22, 2018

const bugsnagClient = bugsnag({
  apiKey: process.env.BUGSNAG_API_KEY,
  beforeSend: function(report) {
    if (
      report.errorMessage === "Request failed with status code 401" ||
      report.errorMessage === "Request failed with status code 403" ||
      report.errorMessage === "Request failed with status code 422" ||
      report.errorMessage === "Request failed with status code 502" ||
      report.errorMessage === "Request failed with status code 503"
    ) {
      report.ignore();
    }
    if (report.errorClass === "SyntaxError") {
      report.ignore();
    }
    if (
      process.env.NODE_ENV === "development" &&
      report.errorClass === "RangeError"
    ) {
      report.ignore();
    }
  }
});

import React from "react";
import ReactDOM from "react-dom";
import createPlugin from "bugsnag-react";

import { BrowserRouter } from "react-router-dom";
import { Provider } from "react-redux";
import axios from "axios";
import ScrollToTop from "./common/scroll_to_top";

import { LocaleProvider } from "antd";
import enUS from "antd/lib/locale-provider/en_US";

import Layout from "./layout";
import store from "./store";

import "antd/dist/antd.css";
import "./scss/styles.scss";
import { alert } from "./home/alert";
import { connect } from "react-redux";

// bugsnag({ autoCaptureSessions: false });
axios.defaults.withCredentials = true;

axios.interceptors.response.use(
  response => {
    return response;
  },
  error => {
    if (error.response && error.response.status === 503) {
      window.location.reload();
      return new Promise(() => {});
    }
    if (
      error.response &&
      error.response.status >= 500 &&
      error.response.status < 600
    ) {
      alert("Something unexpected occurred", "", "error");
    }
    return Promise.reject(error);
  }
);

const ErrorBoundary = bugsnagClient.use(createPlugin(React));
const app = document.getElementById("root");

ReactDOM.render(
  <Provider store={store}>
    <BrowserRouter>
      <ScrollToTop>
        <LocaleProvider locale={enUS}>
          <ErrorBoundary>
            <Layout />
          </ErrorBoundary>
        </LocaleProvider>
      </ScrollToTop>
    </BrowserRouter>
  </Provider>,
  app
);

@prakritidev
Copy link

@devilcrucifier Look into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants