mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Updated dropin script to use SSR tokens
no-issue This finalises the use of SSR for the dropin script
This commit is contained in:
parent
73b18e6566
commit
68fa28b4f5
@ -12,7 +12,6 @@ function reload(success) {
|
||||
|
||||
function setupMembersListeners() {
|
||||
const members = layer2({membersUrl: window.membersUrl});
|
||||
const tokenAudience = new URL(window.location.href).origin + '/ghost/api/v2/members/';
|
||||
|
||||
const [hashMatch, hash, query] = window.location.hash.match(/^#([^?]+)\??(.*)$/) || [];
|
||||
|
||||
@ -51,9 +50,7 @@ function setupMembersListeners() {
|
||||
}
|
||||
|
||||
members.on('signedin', function () {
|
||||
members.getToken({
|
||||
audience: tokenAudience
|
||||
}).then(function (token) {
|
||||
members.getSSRToken({fresh: true}).then(function (token) {
|
||||
setCookie(token);
|
||||
});
|
||||
});
|
||||
@ -75,8 +72,7 @@ function setupMembersListeners() {
|
||||
event.preventDefault();
|
||||
members.signin()
|
||||
.then(() => {
|
||||
return members.getToken({
|
||||
audience: tokenAudience,
|
||||
return members.getSSRToken({
|
||||
fresh: true
|
||||
}).then(function (token) {
|
||||
return setCookie(token);
|
||||
@ -89,8 +85,7 @@ function setupMembersListeners() {
|
||||
event.preventDefault();
|
||||
members.upgrade()
|
||||
.then(() => {
|
||||
return members.getToken({
|
||||
audience: tokenAudience,
|
||||
return members.getSSRToken({
|
||||
fresh: true
|
||||
}).then(function (token) {
|
||||
return setCookie(token);
|
||||
|
Loading…
Reference in New Issue
Block a user