Merge remote-tracking branch 'origin' into feat-pedidos

This commit is contained in:
2025-12-11 10:08:12 -03:00
194 changed files with 30374 additions and 10247 deletions

View File

@@ -4,12 +4,13 @@ import { authComponent, updatePassword } from './auth';
/**
* Alterar senha do usuário autenticado
* Token é opcional - autenticação é feita via contexto do Convex
*/
export const alterarSenha = mutation({
args: {
token: v.string(), // Token não é usado, mas mantido para compatibilidade
senhaAtual: v.string(),
novaSenha: v.string()
novaSenha: v.string(),
token: v.optional(v.string()) // Token opcional - não é usado, mas mantido para compatibilidade
},
returns: v.union(
v.object({ sucesso: v.literal(true) }),
@@ -43,14 +44,12 @@ export const alterarSenha = mutation({
return {
sucesso: true as const
};
} catch (error: any) {
} catch (error: unknown) {
// Capturar erros específicos do Better Auth
let mensagemErro = 'Erro ao alterar senha';
if (error?.message) {
if (error instanceof Error && 'message' in error) {
mensagemErro = error.message;
} else if (typeof error === 'string') {
mensagemErro = error;
}
// Mensagens de erro mais amigáveis