Skip to content

Commit 28d7bcd

Browse files
authored
Merge pull request #444 from folknor/fix-442
Transpilers like swc must be able to transform async functions
2 parents 43ca707 + 2575a18 commit 28d7bcd

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/controllers/dataController.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ const getData = async (ctx, query) => {
1111

1212
if (data.cache && data.store) return;
1313

14-
ctx.feedback = data.store =
15-
typeof data.src === "function"
16-
? data.src.constructor.name === "AsyncFunction"
17-
? await data.src(query)
18-
: data.src(query)
19-
: data.src;
14+
ctx.feedback = data.store = typeof data.src === "function" ? await data.src(query) : data.src;
2015

2116
/**
2217
* @emit {response} event on data request

0 commit comments

Comments
 (0)