mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
Fix endless running test (#1572)
Fix endless running ui tests. Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
This commit is contained in:
@@ -104,23 +104,22 @@ export const useLogout = () => {
|
||||
const link = useIndexLink("logout");
|
||||
const reset = useReset();
|
||||
|
||||
const { mutate, isLoading, error, data } = useMutation<LogoutResponse, Error, unknown>(() =>
|
||||
apiClient.delete(link!).then(r => (r.status === 200 ? r.json() : {}))
|
||||
const { mutate, isLoading, error, data } = useMutation<LogoutResponse, Error, unknown>(
|
||||
() => apiClient.delete(link!).then(r => (r.status === 200 ? r.json() : {})),
|
||||
{
|
||||
onSuccess: response => {
|
||||
if (response?.logoutRedirect) {
|
||||
window.location.assign(response.logoutRedirect);
|
||||
}
|
||||
reset();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const logout = () => {
|
||||
mutate({});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (data?.logoutRedirect) {
|
||||
window.location.assign(data.logoutRedirect);
|
||||
}
|
||||
if (data) {
|
||||
reset();
|
||||
}
|
||||
}, [data, reset]);
|
||||
|
||||
return {
|
||||
logout: link && !data ? logout : undefined,
|
||||
isLoading,
|
||||
|
||||
Reference in New Issue
Block a user