@@ -16,14 +16,16 @@ import Register from "./components/Auth/Register";
1616import ExpertsNotebook from "./components/Experts/Notebook" ;
1717import StudentSolutionsPage from "./components/Solutions/StudentSolutionsPage" ;
1818import EditProfile from "./components/EditProfile" ;
19- import ApiSingleton , { setAunauthorizedHandler } from "./api/ApiSingleton" ;
19+ import ApiSingleton from "./api/ApiSingleton" ;
2020import SystemInfoComponent from "./components/System/SystemInfoComponent" ;
2121import WrongPath from "./components/WrongPath" ;
2222import ResetPassword from "components/Auth/ResetPassword" ;
2323import PasswordRecovery from "components/Auth/PasswordRecovery" ;
2424import AuthLayout from "./AuthLayout" ;
2525import ExpertAuthLayout from "./components/Experts/AuthLayout" ;
2626import TrackPageChanges from "TrackPageChanges" ;
27+ import { Alert , Button } from "@mui/material" ;
28+ import { Snackbar } from "@material-ui/core" ;
2729
2830// TODO: add flux
2931
@@ -34,7 +36,6 @@ interface AppState {
3436 newNotificationsCount : number ;
3537 appBarContextAction : AppBarContextAction ;
3638 authReady : boolean ;
37- needAuth : boolean ;
3839}
3940
4041const withRouter = ( Component : any ) => {
@@ -59,15 +60,12 @@ class App extends Component<{ navigate: any }, AppState> {
5960 isExpert : ApiSingleton . authService . isExpert ( ) ,
6061 newNotificationsCount : 0 ,
6162 appBarContextAction : "Default" ,
62- authReady : false ,
63- needAuth : false ,
63+ authReady : false
6464 } ;
6565 appBarStateManager . setOnContextActionChange ( appBarState => this . setState ( { appBarContextAction : appBarState } ) )
6666 }
6767
6868 componentDidMount = async ( ) => {
69- setUnauthorizedHandler ( ( ) => this . setState ( { needAuth : true } ) ) ;
70-
7169 const user = await ApiSingleton . authService . getProfile ( ) ;
7270 this . setState (
7371 {
@@ -94,8 +92,7 @@ class App extends Component<{ navigate: any }, AppState> {
9492 this . setState ( {
9593 loggedIn : true ,
9694 isLecturer : isLecturer ,
97- isExpert : isExpert ,
98- needAuth : false ,
95+ isExpert : isExpert
9996 } )
10097 if ( ! isExpert ) {
10198 await this . updatedNewNotificationsCount ( )
@@ -105,7 +102,7 @@ class App extends Component<{ navigate: any }, AppState> {
105102
106103 logout = async ( ) => {
107104 await ApiSingleton . authService . logout ( ) ;
108- this . setState ( { loggedIn : false , isLecturer : false , isExpert : false , newNotificationsCount : 0 , authReady : true , needAuth : false } ) ;
105+ this . setState ( { loggedIn : false , isLecturer : false , isExpert : false , newNotificationsCount : 0 , authReady : true } ) ;
109106 this . props . navigate ( "/login" ) ;
110107 }
111108
@@ -120,7 +117,6 @@ class App extends Component<{ navigate: any }, AppState> {
120117 onLogout = { this . logout }
121118 contextAction = { this . state . appBarContextAction } />
122119 < TrackPageChanges />
123-
124120 < Routes >
125121 < Route element = { < AuthLayout /> } >
126122 < Route path = "user/edit" element = { < EditProfile isExpert = { this . state . isExpert } /> } />
0 commit comments