0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Added api to update member's profile info

refs https://github.com/TryGhost/members.js/issues/20

- Uses new member update endpoint to update logged-in member's profile info
- Member can update their name, email and newsletter subscription status
This commit is contained in:
Rish 2020-05-20 00:08:42 +05:30
parent f257a35dce
commit 43106c037e

View file

@ -67,6 +67,28 @@ function setupGhostApi() {
});
},
update({email, name, subscribed}) {
const url = endpointFor({type: 'members', resource: 'member'});
return makeRequest({
url,
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
email,
name,
subscribed
})
}).then(function (res) {
if (!res.ok) {
return null;
}
return res.json();
});
},
sendMagicLink({email, emailType, labels}) {
const url = endpointFor({type: 'members', resource: 'send-magic-link'});
return makeRequest({