render() {
console.log("App.render.");
const authState = this.getAuthState();
if (authState === AUTH_STATE_INITIAL_AUTH_ATTEMPT) {
return <Loader text="Please wait..."/>
}
return (
<ErrorBoundary>
<ServerApiProvider value={this.state.serverApi}>
<AppAuthProvider value={this.appAuthContext}>
<DataServiceProvider value={this.dataService}>
<BrowserRouter>
<div className="container-fluid">
<Header brand={this.state.config.brandName}/>
<Switch>
<Route path={'/'} exact component={Main}/>
<Route path={'/administrator'} component={Admin}/>
<Route path={'/login'} component={Login}/>
{/* Если ни один роут не сработал, то переадресуем на главную страницу */}
<Redirect to="/"/>
</Switch>
</div>
</BrowserRouter>
</DataServiceProvider>
</AppAuthProvider>
</ServerApiProvider>
</ErrorBoundary>
);
}