refresh timeline when clicking timeline button

This commit is contained in:
ari melody 2024-06-29 14:54:03 +01:00
parent 3ae05b3f9f
commit c3e706ed73
Signed by: ari
GPG key ID: CF99829C92678188
2 changed files with 6 additions and 4 deletions

View file

@ -12,7 +12,7 @@ export async function getTimeline(clean) {
loading = true; loading = true;
let timeline_data; let timeline_data;
if (get(posts).length === 0) timeline_data = await client.getTimeline() if (clean || get(posts).length === 0) timeline_data = await client.getTimeline()
else timeline_data = await client.getTimeline(get(posts)[get(posts).length - 1].id); else timeline_data = await client.getTimeline(get(posts)[get(posts).length - 1].id);
if (!timeline_data) { if (!timeline_data) {

View file

@ -1,9 +1,10 @@
<script> <script>
import Logo from '../../img/spacesocial-logo.svg'; import Logo from '$lib/../img/spacesocial-logo.svg';
import Button from './Button.svelte'; import Button from './Button.svelte';
import Feed from './Feed.svelte'; import Feed from './Feed.svelte';
import { Client } from '../client/client.js'; import { Client } from '$lib/client/client.js';
import { play_sound } from '../sound.js'; import { play_sound } from '$lib/sound.js';
import { getTimeline } from '$lib/timeline.js';
const VERSION = APP_VERSION; const VERSION = APP_VERSION;
@ -17,6 +18,7 @@
function goTimeline() { function goTimeline() {
if (location.pathname === "/") { if (location.pathname === "/") {
getTimeline(true);
window.scrollTo({ window.scrollTo({
top: 0, top: 0,
behavior: "smooth" behavior: "smooth"