Images on News and Update API.js

This commit is contained in:
aeroreyna
2022-11-11 20:50:49 -05:00
parent 46435bc440
commit 193284e00d
2 changed files with 19 additions and 5 deletions

23
API.js
View File

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

View File

@@ -74,6 +74,7 @@ let Post = (props) => {
<View> <View>
<Chip icon="new-releases" style={{ width: 100 }} >News</Chip> <Chip icon="new-releases" style={{ width: 100 }} >News</Chip>
<Text style={{ fontSize: 18 }}>{cleanContent}</Text> <Text style={{ fontSize: 18 }}>{cleanContent}</Text>
<Media content={post.content} />
</View> </View>
} }
</Hyperlink> </Hyperlink>