mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
fc0e97593b
no-issue In order to issue a redirect we need access to the "raw" req/res objects, which is why we must return the function which gets access to them. The members service is used to create the auth url and to update the users session.
18 lines
681 B
JavaScript
18 lines
681 B
JavaScript
const membersService = require('../../services/members');
|
|
|
|
module.exports = {
|
|
docName: 'members_stripe_connect',
|
|
auth: {
|
|
permissions: true,
|
|
query(frame) {
|
|
// This is something you have to do if you want to use the "framework" with access to the raw req/res
|
|
frame.response = async function (req, res) {
|
|
function setSessionProp(prop, val) {
|
|
req.session[prop] = val;
|
|
}
|
|
const stripeConnectAuthURL = await membersService.stripeConnect.getStripeConnectOAuthUrl(setSessionProp);
|
|
return res.redirect(stripeConnectAuthURL);
|
|
};
|
|
}
|
|
}
|
|
};
|