2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Fixed generation of api urls for members service (#10869)

no-issue

Previously we used urlFor which wasn't setup to correctly support
members. This changes members service to use the admin URL directly
This commit is contained in:
Fabien O'Carroll 2019-07-04 12:05:56 +07:00 committed by GitHub
parent 1225bd2fe9
commit 683e37c764
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,8 +116,16 @@ const siteOrigin = doBlock(() => {
return `${protocol}//${host}`;
});
const contentApiUrl = urlUtils.urlFor('api', {version: 'v2', type: 'content'}, true);
const membersApiUrl = urlUtils.urlFor('api', {version: 'v2', type: 'members'}, true);
const getApiUrl = ({version, type}) => {
const {href} = new url.URL(
urlUtils.getApiPath({version, type}),
urlUtils.urlFor('admin', true)
);
return href;
};
const contentApiUrl = getApiUrl({version: 'v2', type: 'content'});
const membersApiUrl = getApiUrl({version: 'v2', type: 'members'});
const accessControl = {
[siteOrigin]: {