mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-12-23 08:49:48 +01:00
Add feedback form (#1967)
Add feedback button and form. This feedback form can be used to provide direct feedback to the SCM-Manager Team. Co-authored-by: Matthias Thieroff <matthias.thieroff@cloudogu.com>
This commit is contained in:
@@ -30,20 +30,23 @@ import { requiredLink } from "./links";
|
||||
|
||||
export const useConfig = (): ApiResult<Config> => {
|
||||
const indexLink = useIndexLink("config");
|
||||
return useQuery<Config, Error>("config", () => apiClient.get(indexLink!).then((response) => response.json()), {
|
||||
enabled: !!indexLink,
|
||||
return useQuery<Config, Error>("config", () => apiClient.get(indexLink!).then(response => response.json()), {
|
||||
enabled: !!indexLink
|
||||
});
|
||||
};
|
||||
|
||||
export const useUpdateConfig = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const { mutate, isLoading, error, data, reset } = useMutation<unknown, Error, Config>(
|
||||
(config) => {
|
||||
config => {
|
||||
const updateUrl = requiredLink(config, "update");
|
||||
return apiClient.put(updateUrl, config, "application/vnd.scmm-config+json;v=2");
|
||||
},
|
||||
{
|
||||
onSuccess: () => queryClient.invalidateQueries("config"),
|
||||
onSuccess: async () => {
|
||||
await queryClient.invalidateQueries("config");
|
||||
await queryClient.invalidateQueries("index");
|
||||
}
|
||||
}
|
||||
);
|
||||
return {
|
||||
@@ -51,6 +54,6 @@ export const useUpdateConfig = () => {
|
||||
isLoading,
|
||||
error,
|
||||
isUpdated: !!data,
|
||||
reset,
|
||||
reset
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user