cursor pagination in notifs
This commit is contained in:
@@ -22,7 +22,14 @@ export class ResponseInterceptor implements NestInterceptor {
|
|||||||
map(data => {
|
map(data => {
|
||||||
// If data is already wrapped or doesn't need wrapping, return as-is
|
// If data is already wrapped or doesn't need wrapping, return as-is
|
||||||
if (data && typeof data === 'object' && 'data' in data && 'success' in data) {
|
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)
|
// 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) {
|
if (data && 'data' in data) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
statusCode,
|
statusCode,
|
||||||
success: true,
|
success: true,
|
||||||
data: (data as any).data,
|
data: data.data,
|
||||||
...('nextCursor' in (data as any) && (data as any).nextCursor != null
|
...('nextCursor' in data
|
||||||
? { nextCursor: (data as any).nextCursor }
|
? { nextCursor: (data as any).nextCursor }
|
||||||
: {}),
|
: {}),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user