mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
Fix administration page error for empty release feed url (#1667)
This commit is contained in:
@@ -22,14 +22,21 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
import { ApiResult, useRequiredIndexLink } from "./base";
|
||||
import { ApiResult, useIndexLink } from "./base";
|
||||
import { UpdateInfo } from "@scm-manager/ui-types";
|
||||
import { useQuery } from "react-query";
|
||||
import { apiClient } from "@scm-manager/ui-components";
|
||||
|
||||
export const useUpdateInfo = (): ApiResult<UpdateInfo | null> => {
|
||||
const indexLink = useRequiredIndexLink("updateInfo");
|
||||
return useQuery<UpdateInfo | null, Error>("updateInfo", () =>
|
||||
apiClient.get(indexLink).then(response => (response.status === 204 ? null : response.json()))
|
||||
const indexLink = useIndexLink("updateInfo");
|
||||
return useQuery<UpdateInfo | null, Error>(
|
||||
"updateInfo",
|
||||
() => {
|
||||
if (!indexLink) {
|
||||
throw new Error("could not find index data");
|
||||
}
|
||||
return apiClient.get(indexLink).then((response) => (response.status === 204 ? null : response.json()));
|
||||
},
|
||||
{ enabled: !!indexLink }
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user