0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Updated URL and response handling for identity token

no-issue

This just keeps the admin in line with the changes made in
https://github.com/TryGhost/Ghost/pull/11559/files
This commit is contained in:
Fabien O'Carroll 2020-03-12 14:15:54 +02:00
parent 6cc70f8918
commit da3f92fac4

View file

@ -13,9 +13,10 @@ export default Component.extend({
let iframe = this.element.querySelector('#billing-frame'); let iframe = this.element.querySelector('#billing-frame');
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
if (event && event.data && event.data.request === 'token') { if (event && event.data && event.data.request === 'token') {
const ghostIdentityUrl = this.get('ghostPaths.url').api('ghost-identity'); const ghostIdentityUrl = this.get('ghostPaths.url').api('identities');
this.ajax.post(ghostIdentityUrl).then(({token}) => { this.ajax.request(ghostIdentityUrl).then((response) => {
const token = response && response.identities && response.identities[0] && response.identities[0].token;
iframe.contentWindow.postMessage({ iframe.contentWindow.postMessage({
request: 'token', request: 'token',
response: token response: token