cursor pagination in notifs
This commit is contained in:
@@ -22,7 +22,14 @@ export class ResponseInterceptor implements NestInterceptor {
|
||||
map(data => {
|
||||
// If data is already wrapped or doesn't need wrapping, return as-is
|
||||
if (data && typeof data === 'object' && 'data' in data && 'success' in data) {
|
||||
return data;
|
||||
console.log('data', data)
|
||||
|
||||
return {
|
||||
data: data,
|
||||
...('nextCursor' in (data as any) && (data as any).nextCursor != null
|
||||
? { nextCursor: (data as any).nextCursor }
|
||||
: {}),
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this is a paginated result (has both data and meta properties)
|
||||
@@ -36,11 +43,12 @@ export class ResponseInterceptor implements NestInterceptor {
|
||||
}
|
||||
|
||||
if (data && 'data' in data) {
|
||||
|
||||
return {
|
||||
statusCode,
|
||||
success: true,
|
||||
data: (data as any).data,
|
||||
...('nextCursor' in (data as any) && (data as any).nextCursor != null
|
||||
data: data.data,
|
||||
...('nextCursor' in data
|
||||
? { nextCursor: (data as any).nextCursor }
|
||||
: {}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user