diff --git a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte index b5ece0e..99b9cbf 100644 --- a/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte +++ b/apps/web/src/routes/(dashboard)/recursos-humanos/funcionarios/cadastro/+page.svelte @@ -24,7 +24,8 @@ } from '$lib/utils/constants'; import { categoriasDocumentos, getDocumentosByCategoria } from '$lib/utils/documentos'; import ModelosDeclaracoes from '$lib/components/ModelosDeclaracoes.svelte'; - import { Trash, X } from 'lucide-svelte'; + import { Trash } from 'lucide-svelte'; + import { resolve } from '$app/paths'; const client = useConvexClient(); @@ -236,8 +237,8 @@ } async function loadSimbolos() { - const list = await client.query(api.simbolos.getAll, {} as any); - simbolos = list.map((s: any) => ({ + const list = await client.query(api.simbolos.getAll, {}); + simbolos = list.map((s) => ({ _id: s._id, nome: s.nome, tipo: s.tipo, @@ -275,8 +276,9 @@ const { storageId } = await result.json(); documentosStorage[campo] = storageId; - } catch (err: any) { - throw new Error(err?.message || 'Erro ao fazer upload'); + } catch (err: unknown) { + const error = err as Error; + throw new Error(error.message || 'Erro ao fazer upload'); } } @@ -321,7 +323,7 @@ cep: onlyDigits(cep), cidade, uf: uf.toUpperCase(), - simboloId: simboloId as any, + simboloId: simboloId, simboloTipo: tipo, admissaoData: admissaoData || undefined, desligamentoData: undefined, @@ -410,9 +412,10 @@ } notice = { kind: 'success', text: 'Funcionário cadastrado com sucesso!' }; - setTimeout(() => goto('/recursos-humanos/funcionarios'), 600); - } catch (e: any) { - const msg = e?.message || String(e); + setTimeout(() => goto(resolve('/recursos-humanos/funcionarios')), 600); + } catch (e: unknown) { + const error = e as Error; + const msg = error.message || String(error); if (/CPF j[aá] cadastrado/i.test(msg)) { notice = { kind: 'error', text: 'CPF já cadastrado.' }; } else if (/Matr[ií]cula j[aá] cadastrada/i.test(msg)) { @@ -440,9 +443,13 @@