From ddff3e850f0c3bff939d6af5eedaffebef64f419 Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Tue, 17 Dec 2024 17:12:15 +0700 Subject: [PATCH] Removed unused variables --- apps/comments-ui/src/actions.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/comments-ui/src/actions.ts b/apps/comments-ui/src/actions.ts index fcb0afc784..296799606f 100644 --- a/apps/comments-ui/src/actions.ts +++ b/apps/comments-ui/src/actions.ts @@ -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}); } }