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}) { 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 = { const commentStructured = {
...comment, ...comment,
member: state.member, // Temporary workaround for missing member relation (bug in API)
created_at: new Date().toISOString() member: state.member
}; };
return { return {

View file

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