feat(navigation): add profile stack navigator and fix API endpoints
- Add ProfileStackNavigatorComponent with full navigation stack (Profile, Settings, EditProfile, AccountSecurity, MyPosts, Bookmarks, NotificationSettings, BlockedUsers) - Add null checks for response data in authService login, register, and refreshToken methods - Fix postService API routes to use correct endpoints (/posts instead of /posts/cursor) - Remove completed cursor pagination design document
This commit is contained in:
@@ -287,19 +287,17 @@ class PostService {
|
||||
|
||||
/**
|
||||
* 获取帖子列表(游标分页)
|
||||
* GET /api/v1/posts/cursor
|
||||
* GET /api/v1/posts
|
||||
* @param params 游标分页请求参数(包含 post_type 可选:recommend, follow, hot, latest)
|
||||
*/
|
||||
async getPostsCursor(
|
||||
params: CursorPaginationRequest = {}
|
||||
): Promise<CursorPaginationResponse<Post>> {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<Post>>('/posts/cursor', {
|
||||
params: {
|
||||
cursor: params.cursor,
|
||||
page_size: params.page_size,
|
||||
post_type: params.post_type,
|
||||
},
|
||||
async getPostsCursor(
|
||||
params: CursorPaginationRequest = {}
|
||||
): Promise<CursorPaginationResponse<Post>> {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<Post>>('/posts', {
|
||||
cursor: params.cursor,
|
||||
page_size: params.page_size,
|
||||
post_type: params.post_type,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
@@ -315,7 +313,7 @@ class PostService {
|
||||
|
||||
/**
|
||||
* 搜索帖子(游标分页)
|
||||
* GET /api/v1/posts/search/cursor
|
||||
* GET /api/v1/posts/search
|
||||
* @param query 搜索关键词
|
||||
* @param params 游标分页请求参数
|
||||
*/
|
||||
@@ -324,11 +322,9 @@ class PostService {
|
||||
params: CursorPaginationRequest = {}
|
||||
): Promise<CursorPaginationResponse<Post>> {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<Post>>('/posts/search/cursor', {
|
||||
params: {
|
||||
...params,
|
||||
keyword: query,
|
||||
},
|
||||
const response = await api.get<CursorPaginationResponse<Post>>('/posts/search', {
|
||||
...params,
|
||||
keyword: query,
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
@@ -344,7 +340,7 @@ class PostService {
|
||||
|
||||
/**
|
||||
* 获取用户帖子列表(游标分页)
|
||||
* GET /api/v1/users/:id/posts/cursor
|
||||
* GET /api/v1/users/:id/posts
|
||||
* @param userId 用户ID
|
||||
* @param params 游标分页请求参数
|
||||
*/
|
||||
@@ -354,8 +350,8 @@ class PostService {
|
||||
): Promise<CursorPaginationResponse<Post>> {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<Post>>(
|
||||
`/users/${userId}/posts/cursor`,
|
||||
{ params }
|
||||
`/users/${userId}/posts`,
|
||||
params
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user