Close dialog on status change

This commit is contained in:
Jose Selesan
2026-05-06 17:03:42 -03:00
parent 41a217e8a9
commit 7be776f189
22 changed files with 408 additions and 428 deletions

View File

@@ -1,58 +1,58 @@
// lib/errors.ts
export type ValidationIssue = {
path: string
message: string
}
path: string;
message: string;
};
export type AppError =
| {
type: 'validation'
message: string
issues?: ValidationIssue[]
type: 'validation';
message: string;
issues?: ValidationIssue[];
}
| {
type: 'not_found'
message: string
type: 'not_found';
message: string;
}
| {
type: 'conflict'
message: string
type: 'conflict';
message: string;
}
| {
type: 'unauthorized'
message: string
type: 'unauthorized';
message: string;
}
| {
type: 'forbidden'
message: string
type: 'forbidden';
message: string;
}
| {
type: 'unexpected'
message: string
}
type: 'unexpected';
message: string;
};
export const Errors = {
validation(message: string, issues?: ValidationIssue[]): AppError {
return { type: 'validation', message, issues }
return { type: 'validation', message, issues };
},
notFound(message = 'Resource not found'): AppError {
return { type: 'not_found', message }
return { type: 'not_found', message };
},
conflict(message: string): AppError {
return { type: 'conflict', message }
return { type: 'conflict', message };
},
unauthorized(message = 'Unauthorized'): AppError {
return { type: 'unauthorized', message }
return { type: 'unauthorized', message };
},
forbidden(message = 'Forbidden'): AppError {
return { type: 'forbidden', message }
return { type: 'forbidden', message };
},
unexpected(message = 'Unexpected error'): AppError {
return { type: 'unexpected', message }
}
}
return { type: 'unexpected', message };
},
};