Initial commit
Build / run (push) Has been cancelled

This commit is contained in:
maher
2026-05-14 13:42:10 +02:00
commit 511fad8199
4595 changed files with 385164 additions and 0 deletions
@@ -0,0 +1,27 @@
import {useMutation} from '@tanstack/react-query';
import {toast} from '../../../../ui/toast/toast';
import {BackendResponse} from '../../../../http/backend-response/backend-response';
import {User} from '../../../user';
import {message} from '../../../../i18n/message';
import {apiClient} from '../../../../http/query-client';
import {showHttpErrorToast} from '../../../../utils/http/show-http-error-toast';
interface Response extends BackendResponse {}
interface UserProps {
user: User;
}
function removeAvatar(user: User): Promise<Response> {
return apiClient.delete(`users/${user.id}/avatar`).then(r => r.data);
}
export function useRemoveAvatar({user}: UserProps) {
return useMutation({
mutationFn: () => removeAvatar(user),
onSuccess: () => {
toast(message('Removed avatar'));
},
onError: err => showHttpErrorToast(err),
});
}