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:
Eduard Heimbuch
2022-03-10 09:39:17 +01:00
committed by GitHub
parent 390384b723
commit 4407dc6d8a
22 changed files with 235 additions and 21 deletions

View File

@@ -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
};
};