18 lines
293 B
JavaScript
18 lines
293 B
JavaScript
/** @type {import('pocketpages').PageDataLoaderFunc} */
|
|
|
|
|
|
/**
|
|
*
|
|
* This middleware handles setting data.user for auth purposes
|
|
*/
|
|
module.exports = function ({ auth }, next) {
|
|
|
|
let user;
|
|
|
|
if (auth) {
|
|
user = $app.findFirstRecordByData('users', 'id', auth.id);
|
|
}
|
|
|
|
next({ user })
|
|
}
|