♻️ Use unified post list api

This commit is contained in:
2024-02-09 11:43:21 +08:00
parent 86e184a803
commit 798e78ff8e
4 changed files with 11 additions and 40 deletions

View File

@ -29,9 +29,10 @@ export default function RealmPage() {
async function readPosts(pn?: number) {
if (pn) setPage(pn);
const res = await fetch(`/api/realms/${params["realmId"]}/posts?` + new URLSearchParams({
const res = await fetch(`/api/posts?` + new URLSearchParams({
take: (10).toString(),
offset: ((page() - 1) * 10).toString()
offset: ((page() - 1) * 10).toString(),
realmId: params["realmId"],
}));
if (res.status !== 200) {
setError(await res.text());