Lookup Class Method Returns Empty Object Instead Of User Data
So, I am creating different helpers to reduce some code on my controller. So I created a class called Lookup to help me search for users in my database and I created a searchAccoun
Solution 1:
The keyword yield
can be only used inside a generator. searchAccountKey
is currently a normal function. You need to use *
before the name of the function to make it a generator.
static * searchAccountKey (key, callback) {
const user = yield User.findBy('key', key)
// ...
}
After this change you will need to call Lookup.searchAccountKey
with yield
also.
yield Lookup.searchAccountKey(...)
Post a Comment for "Lookup Class Method Returns Empty Object Instead Of User Data"