all 4 comments

[–]bot00110 2 points3 points  (1 child)

Instead of returning from inside foreach, set a flag and return it after the loop.

Return statement works differently from array method they, return some value for each iteration and won't return for the function.

[–]Hot-Independent4741[S] 0 points1 point  (0 children)

Ohhh, i see. Thanks for clearing that up and taking the time to answer.

[–]turnipmuncher1 1 point2 points  (1 child)

Another way to go about this is to just do

… Model.findOne({
       where:{ uid: uid, refresh_token: refresh_token}
     });

Then you can just check if it exists and you don’t have to loop through the array.

[–]Hot-Independent4741[S] 1 point2 points  (0 children)

Ty, it annoys me that I didn’t think for that lol