Checking auth with decorators
This is great, thank you for the reference! Question about that -- why do this middle-ware magic instead of simple function call like
2 Replies
Note that in your code above you're doing something unusual by not awaiting the
checkAuth({ db, auth });
call — it should still work (when the async checkAuth
task fails the transaction will fail) but I wouldn't recommend it because it's confusing and relies on an unusual property of our runtime, that an unhandled promise rejection will cause the transaction to roll back.Oh, thank you for the tip! I'm very much JS noob.