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:
parent
f257a35dce
commit
43106c037e
1 changed files with 22 additions and 0 deletions
|
@ -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({
|
||||
|
|
Loading…
Add table
Reference in a new issue