mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Fixed collections card display when admin/front-end URLs are different (#18196)
no issue - the Content API is served from the Admin URL not the Frontend URL but we were fetching from the Frontend URL. That resulted in a 302 response with no CORS headers so the request was blocked by the browser
This commit is contained in:
parent
a79717e9ba
commit
45bc917dea
1 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
import * as Sentry from '@sentry/ember';
|
||||
import Component from '@glimmer/component';
|
||||
import React, {Suspense} from 'react';
|
||||
import fetch from 'fetch';
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
import {action} from '@ember/object';
|
||||
import {inject} from 'ghost-admin/decorators/inject';
|
||||
|
@ -131,7 +132,6 @@ const WordCountPlugin = (props) => {
|
|||
export default class KoenigLexicalEditor extends Component {
|
||||
@service ajax;
|
||||
@service feature;
|
||||
@service frontend;
|
||||
@service ghostPaths;
|
||||
@service session;
|
||||
@service store;
|
||||
|
@ -250,12 +250,12 @@ export default class KoenigLexicalEditor extends Component {
|
|||
this.contentKey = contentIntegration?.contentKey.secret;
|
||||
}
|
||||
|
||||
const postsUrl = new URL(this.frontend.getUrl('/ghost/api/content/posts/'));
|
||||
const postsUrl = new URL(this.ghostPaths.url.admin('/api/content/posts/'), window.location.origin);
|
||||
postsUrl.searchParams.append('key', this.contentKey);
|
||||
postsUrl.searchParams.append('collection', collectionSlug);
|
||||
postsUrl.searchParams.append('limit', 12);
|
||||
|
||||
const response = await this.frontend.fetch(postsUrl.toString());
|
||||
const response = await fetch(postsUrl.toString());
|
||||
const {posts} = await response.json();
|
||||
|
||||
return posts;
|
||||
|
|
Loading…
Reference in a new issue