fix: Metadata only updated on correct answers

This commit is contained in:
Alexander Polynomdivision
2018-09-30 14:46:32 +02:00
parent 2276dad7a7
commit 64bcc932d7
4 changed files with 27 additions and 16 deletions

View File

@@ -31,6 +31,7 @@ interface IProps {
setAuthenticated: (status: boolean) => void;
setDidLogin: (status: boolean) => void;
setUser: (user: IUser) => void;
setLastReview: (meta: IReviewMetadata) => void;
};
// TODO: Replace the sessionStorage with localStorage?
@@ -106,6 +107,10 @@ export default class Application extends React.Component<IProps> {
}
setLastReview = (meta: IReviewMetadata) => {
// Update the state
this.props.setLastReview(meta);
// Tell the server about the last review
fetch(`${BACKEND_URL}/api/user/lastReview`, {
headers: new Headers({
"Content-Type": "application/json",