|
|
@ -194,6 +194,7 @@ export class FeedService extends BaseService {
|
|
|
|
const updatedPosts = this.posts.getValue();
|
|
|
|
const updatedPosts = this.posts.getValue();
|
|
|
|
const post = this.constructPost(response);
|
|
|
|
const post = this.constructPost(response);
|
|
|
|
this.uploadPostImage(post.id, file).subscribe((result) => {
|
|
|
|
this.uploadPostImage(post.id, file).subscribe((result) => {
|
|
|
|
|
|
|
|
if (result.success) {
|
|
|
|
if (this.activePostList === Sort.NEW) {
|
|
|
|
if (this.activePostList === Sort.NEW) {
|
|
|
|
post.mediaUrl = result.fileName;
|
|
|
|
post.mediaUrl = result.fileName;
|
|
|
|
post.mediaType = result.fileName.endsWith('.png') ? 'IMAGE' : 'VIDEO';
|
|
|
|
post.mediaType = result.fileName.endsWith('.png') ? 'IMAGE' : 'VIDEO';
|
|
|
@ -201,10 +202,15 @@ export class FeedService extends BaseService {
|
|
|
|
this.posts.next(updatedPosts);
|
|
|
|
this.posts.next(updatedPosts);
|
|
|
|
this.posting.next(false);
|
|
|
|
this.posting.next(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.error(result.error);
|
|
|
|
|
|
|
|
this.posting.next(false);
|
|
|
|
|
|
|
|
this.deletePost(post.id).subscribe();
|
|
|
|
|
|
|
|
}
|
|
|
|
}, error => {
|
|
|
|
}, error => {
|
|
|
|
console.error(error);
|
|
|
|
console.error(error);
|
|
|
|
this.posting.next(false);
|
|
|
|
this.posting.next(false);
|
|
|
|
this.deletePost(post.id);
|
|
|
|
this.deletePost(post.id).subscribe();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
));
|
|
|
|
));
|
|
|
|