diff options
Diffstat (limited to 'helpers/log.js')
-rw-r--r-- | helpers/log.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/helpers/log.js b/helpers/log.js new file mode 100644 index 0000000..5e570c2 --- /dev/null +++ b/helpers/log.js @@ -0,0 +1,13 @@ +import Log from 'models/Log' + +const log = async ({ email, action, callback, error }) => { + try { + await Log.create({ email, action, ...(error && {error: error?.message || '-'}) }) + } finally { + if (callback) { + return callback() + } + } +} + +export default log |