cleanup 3
continuous-integration/drone/pr Build is failing

This commit is contained in:
2026-07-03 17:29:54 -04:00
parent 6231befaa8
commit 232a821dc0
16 changed files with 794 additions and 847 deletions
+5 -9
View File
@@ -1,10 +1,5 @@
import { useToasts } from '../components/ToastContext';
import { getErrorMessage } from '../utils/errors';
interface ApiResponse {
status: number;
data: unknown;
}
import { getErrorMessage, getResponseError, type ApiResponseLike } from '../utils/errors';
interface ToastMutationOptions {
success: string;
@@ -21,9 +16,10 @@ export function useMutationWithToast() {
return function toastMutationOptions({ success, error, onSuccess }: ToastMutationOptions) {
return {
onSuccess: (response: ApiResponse) => {
if (response.status < 200 || response.status >= 300) {
showError(`${error}: ${getErrorMessage(response.data)}`);
onSuccess: (response: ApiResponseLike) => {
const message = getResponseError(response);
if (message) {
showError(`${error}: ${message}`);
return;
}
onSuccess?.();