mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
feat: Add fallback spinner to authentication lazy-loaded pages
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import * as React from 'react';
|
||||
import * as Loadable from 'react-loadable';
|
||||
|
||||
const Loader = (config) =>
|
||||
Loadable({
|
||||
loading: (props) => {
|
||||
if (props.error) {
|
||||
/* tslint:disable */
|
||||
console.error(`======= DefaultLoader Error =======`);
|
||||
console.error(props.error);
|
||||
console.error(`======= DefaultLoader Error =======`);
|
||||
/* tslint:enable */
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
delay: 250,
|
||||
...config
|
||||
});
|
||||
|
||||
export default Loader;
|
||||
@@ -2,10 +2,12 @@
|
||||
import { Route, Switch, useLocation } from 'react-router-dom';
|
||||
import BodyClassName from 'react-body-classname';
|
||||
import styled from 'styled-components';
|
||||
import { Suspense } from 'react';
|
||||
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
||||
import { Spinner } from '@blueprintjs/core';
|
||||
|
||||
import authenticationRoutes from '@/routes/authentication';
|
||||
import { Icon, FormattedMessage as T } from '@/components';
|
||||
import { Box, Icon, FormattedMessage as T } from '@/components';
|
||||
import { AuthMetaBootProvider } from './AuthMetaBoot';
|
||||
|
||||
import '@/style/pages/Authentication/Auth.scss';
|
||||
@@ -20,7 +22,15 @@ export function Authentication() {
|
||||
</AuthLogo>
|
||||
|
||||
<AuthMetaBootProvider>
|
||||
<AuthenticationRoutes />
|
||||
<Suspense
|
||||
fallback={
|
||||
<Box style={{ marginTop: '5rem' }}>
|
||||
<Spinner size={30} />
|
||||
</Box>
|
||||
}
|
||||
>
|
||||
<AuthenticationRoutes />
|
||||
</Suspense>
|
||||
</AuthMetaBootProvider>
|
||||
</AuthInsider>
|
||||
</AuthPage>
|
||||
|
||||
Reference in New Issue
Block a user