0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2024-12-30 22:34:01 -05:00

Removed unused variables

This commit is contained in:
Ronald Langeveld 2024-12-17 17:12:15 +07:00
parent d68bd9375b
commit ddff3e850f

View file

@ -189,7 +189,7 @@ async function showComment({state, api, data: comment}: {state: EditableAppConte
};
}
async function updateCommentLikeState({state, data: comment}: {state: EditableAppContext, data: {id: string, liked: boolean, commentsState: Comment[]}}) {
async function updateCommentLikeState({state, data: comment}: {state: EditableAppContext, data: {id: string, liked: boolean}}) {
return {
comments: state.comments.map((c) => {
const replies = c.replies.map((r) => {
@ -227,24 +227,24 @@ async function updateCommentLikeState({state, data: comment}: {state: EditableAp
};
}
async function likeComment({state, api, data: comment, dispatchAction}: {state: EditableAppContext, api: GhostApi, data: {id: string}, dispatchAction: DispatchActionType}) {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: true, commentsState: state.comments});
async function likeComment({api, data: comment, dispatchAction}: {state: EditableAppContext, api: GhostApi, data: {id: string}, dispatchAction: DispatchActionType}) {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: true});
try {
await api.comments.like({comment});
return {};
} catch (err) {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: false, commentsState: state.comments});
dispatchAction('updateCommentLikeState', {id: comment.id, liked: false});
}
}
async function unlikeComment({state, api, data: comment, dispatchAction}: {state: EditableAppContext, api: GhostApi, data: {id: string}, dispatchAction: DispatchActionType}) {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: false, commentsState: state.comments});
async function unlikeComment({api, data: comment, dispatchAction}: {state: EditableAppContext, api: GhostApi, data: {id: string}, dispatchAction: DispatchActionType}) {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: false});
try {
await api.comments.unlike({comment});
return {};
} catch (err) {
dispatchAction('updateCommentLikeState', {id: comment.id, liked: true, commentsState: state.comments});
dispatchAction('updateCommentLikeState', {id: comment.id, liked: true});
}
}