This commit is contained in:
MuslemRahimi 2024-06-19 16:02:45 +02:00
parent 2a9fd12f3d
commit 6829493cf6
2 changed files with 3 additions and 3 deletions

View File

@ -318,12 +318,13 @@ function updateVote(posts, postVote) {
// Check if expand['alreadyVoted(post)'] exists
if (!post.expand['alreadyVoted(post)']) {
// Create the structure if it does not exist
post.expand['alreadyVoted(post)'] = [
post['expand']['alreadyVoted(post)'] = [
{
type: upvoteClicked ? 'upvote' : downvoteClicked ? 'downvote' : 'neutral',
user: data?.user?.id
}
];
} else {
// Update the existing type based on the click flags
post.expand['alreadyVoted(post)'][0].type = upvoteClicked ? 'upvote' : downvoteClicked ? 'downvote' : 'neutral';
@ -362,7 +363,6 @@ $: {
$: {
if(posts)
{
console.log('caching saved')
$cachedPosts = {"sortingPosts": sortingPosts,'currentPage': currentPage, 'seenPostId': seenPostId, 'posts': posts};
}
}

View File

@ -378,7 +378,7 @@ function updateVote(postVote) {
// Check if expand['alreadyVoted(item)'] exists
if (!item.expand['alreadyVoted(item)']) {
// Create the structure if it does not exist
item.expand['alreadyVoted(post)'] = [
item['expand']['alreadyVoted(post)'] = [
{
type: upvoteClicked ? 'upvote' : downvoteClicked ? 'downvote' : 'neutral',
user: data?.user?.id