Skip to content

Commit

Permalink
feat: add fallback action when add feed failed
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 9, 2024
1 parent 2b366d1 commit 5ad8acf
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/renderer/src/modules/discover/feed-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { useAuthQuery } from "@renderer/hooks/common"
import { apiClient, getFetchErrorMessage } from "@renderer/lib/api-fetch"
import { tipcClient } from "@renderer/lib/client"
import { FeedViewType } from "@renderer/lib/enum"
import { getNewIssueUrl } from "@renderer/lib/issues"
import { cn } from "@renderer/lib/utils"
import { Queries } from "@renderer/queries"
import { useFeed } from "@renderer/queries/feed"
Expand Down Expand Up @@ -86,6 +87,44 @@ export const FeedForm: Component<{
<i className="i-mgc-close-cute-re size-7 text-red-500" />
<p>Error in fetching feed.</p>
<p className="break-all px-8 text-center">{getFetchErrorMessage(feedQuery.error)}</p>

<div className="flex items-center gap-4">
<Button
variant="text"
onClick={() => {
feedQuery.refetch()
}}
>
Retry
</Button>

<Button
variant="primary"
onClick={() => {
window.open(
getNewIssueUrl({
body: [
"### Info:",
"",
"Feed URL:",
"```",
url,
"```",
"",
"Error:",
"```",
getFetchErrorMessage(feedQuery.error),
"```",
].join("\n"),
title: `Error in fetching feed: ${id ?? url}`,
}),
"_blank",
)
}}
>
Fallback
</Button>
</div>
</div>
) : (
<div className="center h-full grow flex-col">
Expand Down

0 comments on commit 5ad8acf

Please sign in to comment.