mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-25 22:50:04 +05:30
#305: fix bugs and type anotations
This commit is contained in:
parent
42399ef9bf
commit
d0a356050f
@ -8,12 +8,12 @@ const ABORT_ERR = 20;
|
|||||||
|
|
||||||
export default function BsodMiddleware(dispatchBsod: Function, logger: Logger) {
|
export default function BsodMiddleware(dispatchBsod: Function, logger: Logger) {
|
||||||
return {
|
return {
|
||||||
catch(resp?: Resp|InternalServerError): Promise<Resp> {
|
catch<T: Resp<*>|InternalServerError>(resp?: T): Promise<T> {
|
||||||
if (resp && (
|
if (resp && (
|
||||||
(resp instanceof InternalServerError
|
(resp instanceof InternalServerError
|
||||||
&& InternalServerError.error.code !== ABORT_ERR
|
&& resp.error.code !== ABORT_ERR
|
||||||
) || (resp.originalResponse
|
) || (resp.originalResponse
|
||||||
&& /404|5\d\d/.test(resp.originalResponse.status)
|
&& /404|5\d\d/.test((resp.originalResponse.status: string))
|
||||||
)
|
)
|
||||||
)) {
|
)) {
|
||||||
dispatchBsod();
|
dispatchBsod();
|
||||||
|
@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { Route, Switch, Redirect } from 'react-router-dom';
|
import { Route, Switch, Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
import logger from 'services/logger';
|
import logger from 'services/logger';
|
||||||
|
import { browserHistory } from 'services/history';
|
||||||
import { FooterMenu } from 'components/footerMenu';
|
import { FooterMenu } from 'components/footerMenu';
|
||||||
import Profile from 'components/profile/Profile';
|
import Profile from 'components/profile/Profile';
|
||||||
import ChangePasswordPage from 'pages/profile/ChangePasswordPage';
|
import ChangePasswordPage from 'pages/profile/ChangePasswordPage';
|
||||||
|
@ -4,6 +4,7 @@ function InternalServerError(error: Error|string|Object, resp?: Response|Object)
|
|||||||
|
|
||||||
this.name = 'InternalServerError';
|
this.name = 'InternalServerError';
|
||||||
this.message = 'InternalServerError';
|
this.message = 'InternalServerError';
|
||||||
|
this.error = error;
|
||||||
this.stack = (new Error()).stack;
|
this.stack = (new Error()).stack;
|
||||||
|
|
||||||
if (resp) {
|
if (resp) {
|
||||||
|
Loading…
Reference in New Issue
Block a user