refactor: improve type safety and error handling in vacation management components
- Updated the `AprovarFerias.svelte` component to use specific types for `solicitacao` and `gestorId`, enhancing type safety. - Improved error handling by refining catch blocks to handle errors more accurately. - Made minor adjustments to ensure consistent code formatting and readability across the component.
This commit is contained in:
@@ -27,7 +27,7 @@ export const updateDocumento = mutation({
|
||||
// Atualizar o campo específico do documento
|
||||
await ctx.db.patch(args.funcionarioId, {
|
||||
[args.campo]: args.storageId,
|
||||
} as any);
|
||||
});
|
||||
|
||||
return null;
|
||||
},
|
||||
@@ -106,7 +106,7 @@ export const getDocumentosUrls = query({
|
||||
];
|
||||
|
||||
for (const campo of campos) {
|
||||
const storageId = (funcionario as any)[campo];
|
||||
const storageId = funcionario[campo as keyof typeof funcionario] as Id<"_storage"> | undefined;
|
||||
if (storageId) {
|
||||
urls[campo] = await ctx.storage.getUrl(storageId);
|
||||
} else {
|
||||
@@ -114,7 +114,7 @@ export const getDocumentosUrls = query({
|
||||
}
|
||||
}
|
||||
|
||||
return urls as any;
|
||||
return urls;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user