fix: Remove invalid session tokens + Login using the Return key

This commit is contained in:
Alexander Polynomdivision committed 2018-09-30 13:08:14 +02:00
1 parent ff26a39db8
commit 6de51609c0
2 files changed
+12

No files matched your search

+3
View File
@@ -44,6 +44,8 @@ export default class Application extends React.Component<IProps> {
this.props.setUser(user);
this.props.setAuthenticated(true);
}).catch(err => {
// The token is invalid, so we should remove it
removeSessionToken(window);
this.props.setAuthenticated(false);
});
}
@@ -137,6 +139,7 @@ export default class Application extends React.Component<IProps> {
}
getTopTenLearners = (): Promise<TopTen[]> => {
// TODO: Deprecate?
const id = this.props.user.classId;
return new Promise((res, rej) => {
fetch(`${BACKEND_URL}/api/class/${id}/topTen`, {