Display images in diffs

Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
Konstantin Schaper
2023-03-22 11:17:22 +01:00
committed by SCM-Manager
parent 68110ee6b3
commit d257c8616c
22 changed files with 1775 additions and 1017 deletions

View File

@@ -25,6 +25,8 @@ import { apiClient } from "./apiclient";
import { useQuery } from "react-query";
import { ApiResultWithFetching } from "./base";
import type { ContentType } from "@scm-manager/ui-types";
import { UseQueryOptions } from "react-query/types/react/types";
export type { ContentType } from "@scm-manager/ui-types";
function getContentType(url: string): Promise<ContentType> {
@@ -39,9 +41,14 @@ function getContentType(url: string): Promise<ContentType> {
});
}
export const useContentType = (url: string): ApiResultWithFetching<ContentType> => {
const { isLoading, isFetching, error, data } = useQuery<ContentType, Error>(["contentType", url], () =>
getContentType(url)
export const useContentType = (
url: string,
options: Pick<UseQueryOptions<ContentType, Error>, "enabled"> = {}
): ApiResultWithFetching<ContentType> => {
const { isLoading, isFetching, error, data } = useQuery<ContentType, Error>(
["contentType", url],
() => getContentType(url),
options
);
return {
isLoading,