From b007eea53dc23a95f591c9866a4d838affbc1c6a Mon Sep 17 00:00:00 2001 From: sevichecc <91365763+Sevichecc@users.noreply.github.com> Date: Mon, 17 Apr 2023 22:58:48 +0800 Subject: [PATCH] feat: filter the reblog statuses from my status --- src/my-status.tsx | 8 +++++--- src/utils/types.ts | 17 +++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/my-status.tsx b/src/my-status.tsx index f6b0ab0..aefd802 100644 --- a/src/my-status.tsx +++ b/src/my-status.tsx @@ -10,7 +10,7 @@ const cache = new Cache(); export default function ViewStatusCommand() { const cached = cache.get("latest_statuses"); - const [status, setStatus] = useState(cached ? JSON.parse(cached) : []); + const [statuses, setStatuses] = useState(cached ? JSON.parse(cached) : []); const [isLoading, setIsLoading] = useState(true); useEffect(() => { @@ -19,7 +19,7 @@ export default function ViewStatusCommand() { await getAccessToken(); showToast(Toast.Style.Animated, "Loading Status...ε=ε=┌( >_<)┘"); const status = await apiServer.fetchUserStatus(); - setStatus(status); + setStatuses(statuses); showToast(Toast.Style.Success, "Statuses has been loaded ٩(•̤̀ᵕ•̤́๑)ᵒᵏᵎᵎᵎᵎ"); cache.set("latest_statuses", JSON.stringify(status)); } catch (error) { @@ -32,9 +32,11 @@ export default function ViewStatusCommand() { getBookmark(); }, []); + const filterReblog = (statuses:Status[]) => statuses.filter((status)=>!status.reblog) + return ( - {status?.map((status) => ( + {filterReblog(statuses)?.map((status) => (