podia llegar un null

This commit is contained in:
2026-01-12 21:50:24 -03:00
parent 9153160a11
commit 987920dbe4

View File

@@ -11,7 +11,7 @@
interface Props { interface Props {
open: boolean; open: boolean;
usuario: UserResponseDto; usuario: UserResponseDto | null;
} }
let { open = $bindable(), usuario }: Props = $props(); let { open = $bindable(), usuario }: Props = $props();
@@ -51,7 +51,7 @@
try { try {
const req = await fetch(`${$apiBase}/api/admin/give`, { const req = await fetch(`${$apiBase}/api/admin/give`, {
method: 'PATCH', method: 'PATCH',
body: JSON.stringify({ isAdmin: usuario.isAdmin, id: usuario.id }), body: JSON.stringify({ isAdmin: usuario?.isAdmin || false, id: usuario?.id || '' }),
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${$sesionStore?.accessToken}` Authorization: `Bearer ${$sesionStore?.accessToken}`