fix: Sessions not being remembered
This commit is contained in:
parent
f61386662a
commit
30a2b11ab7
@ -22,9 +22,6 @@ import { makeAPICall } from "../api/call";
|
||||
import { BACKEND_URL } from "../config.in";
|
||||
|
||||
import { TrackerEvent } from "../models/tracker";
|
||||
import { ILevel } from "../models/level";
|
||||
import { TopTen } from "../models/learner";
|
||||
import { IVocab } from "../models/vocab";
|
||||
import { IReviewMetadata, ReviewType } from "../models/review";
|
||||
import { IUser } from "../models/user";
|
||||
import { IResponse } from "../models/server";
|
||||
@ -45,7 +42,7 @@ export default class Application extends React.Component<IProps> {
|
||||
// TODO: When asking the server if our session is still valid, a spinner
|
||||
// should be shown
|
||||
const token = getSessionToken(window);
|
||||
if (token !== null && !this.props.authenticated) {
|
||||
if (token !== undefined && !this.props.authenticated) {
|
||||
this.checkAuthStatus(token).then(user => {
|
||||
this.props.setUser(user);
|
||||
this.props.setAuthenticated(true);
|
||||
@ -62,7 +59,7 @@ export default class Application extends React.Component<IProps> {
|
||||
trackAction(TrackerEvent.LOG_IN);
|
||||
|
||||
return makeAPICall("/api/user/me", {
|
||||
token: this.props.user.sessionToken,
|
||||
token,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user