refactor(GroupMembersScreen): enhance member list management with remote data source
- Introduced a new remote data source for managing group members using cursor pagination. - Updated member list loading logic to utilize the new data source, improving data synchronization and loading states. - Enhanced member enrichment process by integrating user profiles into the member list. - Refactored related imports and hooks for better organization and clarity.
This commit is contained in:
@@ -255,7 +255,7 @@ class CommentService {
|
||||
params: CursorPaginationRequest = {}
|
||||
): Promise<CursorPaginationResponse<Comment>> {
|
||||
try {
|
||||
const response = await api.get<any>(`/comments/post/${postId}/cursor`, { params });
|
||||
const response = await api.get<any>(`/comments/post/${postId}/cursor`, params);
|
||||
const raw = response.data;
|
||||
return {
|
||||
list: Array.isArray(raw?.list) ? raw.list : [],
|
||||
@@ -285,7 +285,7 @@ class CommentService {
|
||||
params: CursorPaginationRequest = {}
|
||||
): Promise<CursorPaginationResponse<Comment>> {
|
||||
try {
|
||||
const response = await api.get<any>(`/comments/${commentId}/replies/cursor`, { params });
|
||||
const response = await api.get<any>(`/comments/${commentId}/replies/cursor`, params);
|
||||
const raw = response.data;
|
||||
return {
|
||||
list: Array.isArray(raw?.list) ? raw.list : [],
|
||||
|
||||
@@ -334,9 +334,7 @@ class GroupService {
|
||||
params: CursorPaginationRequest = {}
|
||||
): Promise<CursorPaginationResponse<GroupResponse>> {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<GroupResponse>>('/groups/cursor', {
|
||||
params,
|
||||
});
|
||||
const response = await api.get<CursorPaginationResponse<GroupResponse>>('/groups/cursor', params);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('获取群组列表失败:', error);
|
||||
@@ -362,7 +360,7 @@ class GroupService {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<GroupMemberResponse>>(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/members/cursor`,
|
||||
{ params }
|
||||
params
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
@@ -389,7 +387,7 @@ class GroupService {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<GroupAnnouncementResponse>>(
|
||||
`/groups/${encodeURIComponent(String(groupId))}/announcements/cursor`,
|
||||
{ params }
|
||||
params
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
|
||||
@@ -571,7 +571,7 @@ class MessageService {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<ConversationResponse>>(
|
||||
'/conversations/cursor',
|
||||
{ params }
|
||||
params
|
||||
);
|
||||
const raw = response.data;
|
||||
return {
|
||||
@@ -604,7 +604,7 @@ class MessageService {
|
||||
try {
|
||||
const response = await api.get<any>(
|
||||
`/conversations/${encodeURIComponent(conversationId)}/messages/cursor`,
|
||||
{ params }
|
||||
params
|
||||
);
|
||||
const raw = response.data;
|
||||
return {
|
||||
|
||||
@@ -166,7 +166,7 @@ class NotificationService {
|
||||
try {
|
||||
const response = await api.get<CursorPaginationResponse<Notification>>(
|
||||
'/notifications/cursor',
|
||||
{ params }
|
||||
params
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user