mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
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:
committed by
SCM-Manager
parent
68110ee6b3
commit
d257c8616c
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user