Skip to content

Commit 3522114

Browse files
committed
refactor: clean up ArticleList component and fix restore function definition
1 parent dc485fb commit 3522114

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/app/dashboard/_components/ArticleList.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ import {
2020
ReloadIcon,
2121
} from "@radix-ui/react-icons";
2222

23-
import { useInfiniteQuery, useMutation } from "@tanstack/react-query";
23+
import {
24+
useInfiniteQuery,
25+
useMutation,
26+
useQueryClient,
27+
} from "@tanstack/react-query";
2428
import { differenceInHours } from "date-fns";
2529
import { TrashIcon } from "lucide-react";
2630
import Link from "next/link";
2731

2832
const ArticleList = () => {
2933
const { _t } = useTranslation();
34+
const queryClient = useQueryClient();
35+
const appConfirm = useAppConfirm();
3036
const feedInfiniteQuery = useInfiniteQuery({
3137
queryKey: ["dashboard-articles"],
3238
queryFn: ({ pageParam }) =>
@@ -62,8 +68,6 @@ const ArticleList = () => {
6268
},
6369
});
6470

65-
const appConfirm = useAppConfirm();
66-
6771
return (
6872
<div>
6973
<div className="flex items-center gap-2 justify-between">
@@ -98,7 +102,7 @@ const ArticleList = () => {
98102
{article.title}
99103
</Link>
100104
{article?.delete_scheduled_at && (
101-
<p className="text-destructive">
105+
<p className="text-destructive text-sm">
102106
Article will be deleted within{" "}
103107
{differenceInHours(
104108
new Date(article?.delete_scheduled_at!),

src/backend/services/article.actions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,7 @@ export async function updateMyArticle(
185185
}
186186
}
187187

188-
export const scheduleArticleDelete = async (
189-
article_id: string
190-
): Promise<ActionResponse<unknown>> => {
188+
export const scheduleArticleDelete = async (article_id: string) => {
191189
try {
192190
const session_userID = await authID();
193191
if (!session_userID) {

0 commit comments

Comments
 (0)