fixed following filter

This commit is contained in:
tdgmdev 2023-03-07 18:56:18 -05:00
parent 5eb2a25591
commit 2bb1c9725d
2 changed files with 3 additions and 12 deletions

View file

@ -253,13 +253,11 @@ backend.postBulk = async ({page, id, user, cookies, sort, type}) => {
ROW_COUNT
])
} else if (type == 'follow') {
posts = await db.all('SELECT * from post WHERE username IN (SELECT username from follow WHERE username = ?) ORDER BY '+sort+' DESC LIMIT ?, ?', [
posts = await db.all('SELECT * from post WHERE username IN (SELECT following from follow WHERE username = ?) ORDER BY '+sort+' DESC LIMIT ?, ?', [
userAuth,
page*ROW_COUNT,
ROW_COUNT
])
console.log(posts);
}
posts = posts.map(post => {

View file

@ -9,14 +9,7 @@
<p>
<Button clickFunc={() => { window.location.search = setLocation(window.location,'type',('all')) }}>All users</Button>
<Button clickFunc={() => { window.location.search = setLocation(window.location,'type',('follow')) }}>Followers only</Button>
<Button clickFunc={() => { window.location.search = setLocation(window.location,'type',('follow')) }}>Following only</Button>
</p>
<PostList data={data} />
<p>
{#if data.id > 0}
<Button clickFunc={() => { window.location.search = setLocation(window.location,'page',((data.id)-1)) }}>Previous page</Button>
{/if}
<Button clickFunc={() => { window.location.search = setLocation(window.location,'page',((data.id)+1)) }}>Next page</Button>
</p>