Feed no longer show replies

This commit is contained in:
2024-02-14 18:48:02 +08:00
parent 1baffd4200
commit b0c9368530
3 changed files with 27 additions and 13 deletions

View File

@ -12,10 +12,14 @@ export default function DashboardPage() {
async function readPosts(pn?: number) {
if (pn) setPage(pn);
const res = await fetch("/api/posts?" + new URLSearchParams({
take: (10).toString(),
offset: ((page() - 1) * 10).toString()
}));
const res = await fetch(
"/api/posts?" +
new URLSearchParams({
take: (10).toString(),
offset: ((page() - 1) * 10).toString(),
reply: false.toString(),
}),
);
if (res.status !== 200) {
setError(await res.text());
} else {
@ -28,7 +32,7 @@ export default function DashboardPage() {
const meta: { [id: string]: any } = {
reposting: null,
replying: null,
editing: null
editing: null,
};
meta[field] = data;
setPublishMeta(meta);
@ -39,7 +43,7 @@ export default function DashboardPage() {
const [publishMeta, setPublishMeta] = createStore<any>({
replying: null,
reposting: null,
editing: null
editing: null,
});
return (
@ -47,10 +51,18 @@ export default function DashboardPage() {
<div id="alerts">
<Show when={error()}>
<div role="alert" class="alert alert-error">
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none"
viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
<svg
xmlns="http://www.w3.org/2000/svg"
class="stroke-current shrink-0 h-6 w-6"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
<span class="capitalize">{error()}</span>
</div>
@ -76,4 +88,4 @@ export default function DashboardPage() {
/>
</>
);
}
}