Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/addBrokenLinksReporter #1810

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
698 changes: 698 additions & 0 deletions src/assets/images/NoBrokenLinksImage.tsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/assets/images/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ export * from "./EditorAccordionImage"
export * from "./EditorCardsImage"
export * from "./EditorDividerImage"
export * from "./EditorCardsPlaceholderImage"
export * from "./NoBrokenLinksImage"
1 change: 1 addition & 0 deletions src/constants/queryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const SITE_DASHBOARD_INFO_KEY = "site-dashboard-info"
export const SITE_DASHBOARD_REVIEW_REQUEST_KEY = "site-dashboard-review-request"
export const SITE_DASHBOARD_COLLABORATORS_KEY = "site-dashboard-collaborators"
export const SITE_DASHBOARD_LAUNCH_STATUS_KEY = "site-dashboard-launch-status"
export const SITE_LINK_CHECKER_STATUS_KEY = "site-link-checker-status"
export const NOTIFICATIONS_KEY = "notifications-content"
export const ALL_NOTIFICATIONS_KEY = "all-notifications"
export const LIST_COLLABORATORS_KEY = "list-collaborators"
Expand Down
22 changes: 22 additions & 0 deletions src/hooks/siteDashboardHooks/useGetLinkChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { UseQueryResult, useQuery } from "react-query"

import { SITE_LINK_CHECKER_STATUS_KEY } from "constants/queryKeys"

import * as LinkCheckerService from "services/LinkCheckerService"

import { RepoErrorDto } from "types/linkReport"

export const useGetBrokenLinks = (
siteName: string
): UseQueryResult<RepoErrorDto> => {
return useQuery<RepoErrorDto>(
[SITE_LINK_CHECKER_STATUS_KEY, siteName],
() => {
return LinkCheckerService.getLinkCheckerStatus({ siteName })
},
{
retry: false,
refetchInterval: 1000 * 10,
}
)
}
22 changes: 22 additions & 0 deletions src/hooks/siteDashboardHooks/useRefreshLinkChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { AxiosError } from "axios"
import { useMutation, UseMutationResult, useQueryClient } from "react-query"

import { SITE_LINK_CHECKER_STATUS_KEY } from "constants/queryKeys"

import * as LinkCheckerService from "services/LinkCheckerService"

export const useRefreshLinkChecker = (
siteName: string
): UseMutationResult<void, AxiosError, string> => {
const queryClient = useQueryClient()
return useMutation<void, AxiosError, string>(
async () => {
await LinkCheckerService.refreshLinkChecker({ siteName })
},
{
onSettled: () => {
queryClient.invalidateQueries([SITE_LINK_CHECKER_STATUS_KEY, siteName])
},
}
)
}
Loading
Loading