Merge remote-tracking branch 'origin' into feat-pedidos
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import { authStore } from '$lib/stores/auth.svelte';
|
||||
|
||||
const convex = useConvexClient();
|
||||
const currentUser = useQuery(api.auth.getCurrentUser, {});
|
||||
@@ -101,15 +100,22 @@
|
||||
carregando = true;
|
||||
|
||||
try {
|
||||
if (!authStore.token) {
|
||||
throw new Error('Token não encontrado');
|
||||
}
|
||||
|
||||
const resultado = await convex.mutation(api.autenticacao.alterarSenha, {
|
||||
token: authStore.token,
|
||||
// Construir objeto de argumentos, incluindo token apenas se existir
|
||||
const args: {
|
||||
senhaAtual: string;
|
||||
novaSenha: string;
|
||||
token?: string;
|
||||
} = {
|
||||
senhaAtual: senhaAtual,
|
||||
novaSenha: novaSenha
|
||||
});
|
||||
};
|
||||
|
||||
// Adicionar token apenas se existir
|
||||
if (authStore.token) {
|
||||
args.token = authStore.token;
|
||||
}
|
||||
|
||||
const resultado = await convex.mutation(api.autenticacao.alterarSenha, args);
|
||||
|
||||
if (resultado.sucesso) {
|
||||
notice = {
|
||||
|
||||
Reference in New Issue
Block a user