diff --git a/API.js b/API.js index 88d9f71..aa15a75 100644 --- a/API.js +++ b/API.js @@ -114,9 +114,15 @@ const API = { return data; }); }, + async subscribe(subscription){ + return postCall("/subscribe", subscription); + }, resetPassword(email){ return postCall("/resetPassword", {username: email}); }, + changePassword(newPassword){ + return postCall("/resetPassword", {password: newPassword}); + }, currentUserId() { if (!CurrentUserId) this.isLoggedIn(); //replace with cookie return CurrentUserId; @@ -135,12 +141,12 @@ const API = { getVideo(videoId) { return getCall("/post/video/" + videoId); }, - registerToken(token) { - return postCall("/token/", {token}); - }, deletePost(postid){ return deleteCall("/post/" + postid); }, + updatePost(post){ + return postCall("/post/" + post._id, {content: post.content}); + }, newPost(content, toProfile, isNews) { //Content is expected to be a string. let params = { content }; @@ -167,6 +173,9 @@ const API = { newCommentReaction(postid, commentDate) { return postCall("/post/comment/react", { postid, commentDate }); }, + removeCommentReaction(postid, commentDate) { + return postCall("/post/comment/unreact", { postid, commentDate }); + }, //Invitations newInvitation(name, email){ return postCall("/user/invite", { name, email }); @@ -267,16 +276,20 @@ const API = { getGroup(groupid) { return getCall("/user/groups/" + groupid); }, - subscribeToGroup(groupid){ - return getCall("/user/groups/" + groupid + "/subscribe"); + async subscribeToGroup(groupid){ + delete userNameCache[groupid]; + return await getCall("/user/groups/" + groupid + "/subscribe"); }, acceptGroupRequest(profileid, groupid){ + delete userNameCache[groupid]; return postCall("/user/groups/accept", {profileid, groupid}); }, rejectGroupRequest(profileid, groupid){ + delete userNameCache[groupid]; return postCall("/user/groups/reject", {profileid, groupid}); }, unsubscribeToGroup(groupid){ + delete userNameCache[groupid]; return getCall("/user/groups/" + groupid + "/unsubscribe"); }, //Payments diff --git a/components/Post.js b/components/Post.js index de51347..01ba2fc 100644 --- a/components/Post.js +++ b/components/Post.js @@ -74,6 +74,7 @@ let Post = (props) => { News {cleanContent} + }