0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Fixed adding comments missing some properties

This commit is contained in:
Simon Backx 2022-07-06 17:30:44 +02:00
parent 3ce42c05f6
commit dc196ddeb1
2 changed files with 5 additions and 4 deletions

View file

@ -13,12 +13,13 @@ async function loadMoreComments({state, api}) {
}
async function addComment({state, api, data: comment}) {
await api.comments.add({comment});
const data = await api.comments.add({comment});
comment = data.comments[0];
const commentStructured = {
...comment,
member: state.member,
created_at: new Date().toISOString()
// Temporary workaround for missing member relation (bug in API)
member: state.member
};
return {

View file

@ -115,7 +115,7 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) {
body: JSON.stringify(body)
}).then(function (res) {
if (res.ok) {
return 'Success';
return res.json();
} else {
throw new Error('Failed to add comment');
}