Fix minor loading bug.
This commit is contained in:
parent
940ea569c7
commit
deae2b6ade
1 changed files with 12 additions and 8 deletions
4
ui/src/utils.ts
vendored
4
ui/src/utils.ts
vendored
|
@ -613,6 +613,7 @@ export function createPostLikeFindRes(data: PostResponse, posts: Array<Post>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createPostLikeRes(data: PostResponse, post: Post) {
|
export function createPostLikeRes(data: PostResponse, post: Post) {
|
||||||
|
if (post) {
|
||||||
post.score = data.post.score;
|
post.score = data.post.score;
|
||||||
post.upvotes = data.post.upvotes;
|
post.upvotes = data.post.upvotes;
|
||||||
post.downvotes = data.post.downvotes;
|
post.downvotes = data.post.downvotes;
|
||||||
|
@ -620,6 +621,7 @@ export function createPostLikeRes(data: PostResponse, post: Post) {
|
||||||
post.my_vote = data.post.my_vote;
|
post.my_vote = data.post.my_vote;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function editPostFindRes(data: PostResponse, posts: Array<Post>) {
|
export function editPostFindRes(data: PostResponse, posts: Array<Post>) {
|
||||||
let found = posts.find(c => c.id == data.post.id);
|
let found = posts.find(c => c.id == data.post.id);
|
||||||
|
@ -629,10 +631,12 @@ export function editPostFindRes(data: PostResponse, posts: Array<Post>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function editPostRes(data: PostResponse, post: Post) {
|
export function editPostRes(data: PostResponse, post: Post) {
|
||||||
|
if (post) {
|
||||||
post.url = data.post.url;
|
post.url = data.post.url;
|
||||||
post.name = data.post.name;
|
post.name = data.post.name;
|
||||||
post.nsfw = data.post.nsfw;
|
post.nsfw = data.post.nsfw;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function commentsToFlatNodes(
|
export function commentsToFlatNodes(
|
||||||
comments: Array<Comment>
|
comments: Array<Comment>
|
||||||
|
|
Reference in a new issue