Skip to content

Commit e9d817b

Browse files
Merge pull request marshallswain#153 from MajesticPotatoe/patch-2
feat(normalize-find): provide default context.result for find
2 parents c47cfb7 + 3ac3f2f commit e9d817b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/hooks/6-normalize-find.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ export function normalizeFind() {
2020

2121
next && await next()
2222

23-
// if (context.method === 'find' && !context.result?.data) {
24-
// context.result = { data: context.result }
25-
// }
23+
if (context.method === 'find' && !context.result?.data) {
24+
context.result = {
25+
data: [],
26+
limit: context.params.$limit,
27+
skip: context.params.$skip,
28+
total: 0,
29+
}
30+
}
2631
}
2732
}

0 commit comments

Comments
 (0)