mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added support for passing thunk for membersApi
no-issue This is to allow support for consumers to dynamically update their membersApi instance, for example when configuration changes, and not have to replace the instance of members-ssr
This commit is contained in:
parent
192f27b5bd
commit
942187f48e
1 changed files with 5 additions and 1 deletions
|
@ -29,6 +29,10 @@ const withBodyAndCookies = (fn, cookieConfig) => (req, res) => {
|
|||
});
|
||||
};
|
||||
|
||||
const get = (value) => {
|
||||
return typeof value === 'function' ? value() : value;
|
||||
};
|
||||
|
||||
module.exports = function create(options = EMPTY) {
|
||||
if (options === EMPTY) {
|
||||
throw new Error('Must pass options');
|
||||
|
@ -56,7 +60,7 @@ module.exports = function create(options = EMPTY) {
|
|||
secure: cookieSecure
|
||||
};
|
||||
|
||||
const verifyJwt = token => membersApi.getPublicConfig().then(({publicKey, issuer}) => {
|
||||
const verifyJwt = token => get(membersApi).getPublicConfig().then(({publicKey, issuer}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
jwt.verify(token, publicKey, {
|
||||
algorithms: ['RS512'],
|
||||
|
|
Loading…
Add table
Reference in a new issue