feat: port pagination and drag-drop upload from upstream

- GET /api/posts now supports page/limit, returns {data, pagination}
- Feed: pagination controls (‹ page numbers ›), reset to page 1 on sort change
- NewPost: dashed drop zone with click/drag-drop image upload, 5MB limit
- UserProfile adapts to paginated response
This commit is contained in:
lezi-fun committed 2026-08-09 21:14:18 +08:00
1 parent 96c3ac3bb9
commit 02ac24ba88
5 files changed
+110 -25

No files matched your search

+2 -2
View File
@@ -48,8 +48,8 @@ export const API = {
getMe() { return apiFetch('/auth/me'); },
// 帖子
getPosts(sort, userId) {
let q = '/posts?sort=' + (sort || 'latest');
getPosts(sort, userId, page = 1, limit = 20) {
let q = '/posts?sort=' + (sort || 'latest') + '&page=' + page + '&limit=' + limit;
if (userId) q += '&user_id=' + userId;
return apiFetch(q);
},