From 30a2b11ab7d51ad85747f0a8458e5ef7fbb0e467 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Wed, 17 Oct 2018 21:16:44 +0200 Subject: [PATCH] fix: Sessions not being remembered --- frontend/src/components/app.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/app.tsx b/frontend/src/components/app.tsx index 7102fc8..3d1b3b3 100644 --- a/frontend/src/components/app.tsx +++ b/frontend/src/components/app.tsx @@ -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 { // 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 { trackAction(TrackerEvent.LOG_IN); return makeAPICall("/api/user/me", { - token: this.props.user.sessionToken, + token, method: "get", }) }