fix: Metadata only updated on correct answers
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user