feat: Points for doing reviews
This commit is contained in:
@@ -31,7 +31,8 @@ interface IProps {
|
||||
setAuthenticated: (status: boolean) => void;
|
||||
setDidLogin: (status: boolean) => void;
|
||||
setUser: (user: IUser) => void;
|
||||
setLastReview: (meta: IReviewMetadata) => void;
|
||||
setLastReview: (meta: IReviewMetadata, delta: number) => void;
|
||||
setUserScoreDelta: (delta: number) => void;
|
||||
};
|
||||
|
||||
// TODO: Replace the sessionStorage with localStorage?
|
||||
@@ -107,9 +108,10 @@ export default class Application extends React.Component<IProps> {
|
||||
}
|
||||
|
||||
// TODO: Type?
|
||||
setLastReview = (meta: IReviewMetadata, sm2: any) => {
|
||||
setLastReview = (meta: IReviewMetadata, sm2: any, delta: number) => {
|
||||
// Update the state
|
||||
this.props.setLastReview(meta);
|
||||
this.props.setUserScoreDelta(delta);
|
||||
|
||||
// Tell the server about the last review
|
||||
fetch(`${BACKEND_URL}/api/user/lastReview`, {
|
||||
@@ -121,6 +123,7 @@ export default class Application extends React.Component<IProps> {
|
||||
body: JSON.stringify({
|
||||
meta,
|
||||
sm2,
|
||||
delta,
|
||||
}),
|
||||
}).then(resp => resp.json(), err => {
|
||||
console.log("Application::setLastReview: POSTing last results failed");
|
||||
|
||||
Reference in New Issue
Block a user