arreglado acceso a la store

This commit is contained in:
2025-12-01 22:33:39 -03:00
parent b15f08659f
commit 476c1308d0

View File

@@ -1,14 +1,15 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { apiBase } from '@/stores/url'; import { apiBase } from '@/stores/url';
import { sesionStore } from '@/stores/usuario'; import { sesionStore } from '@/stores/usuario';
import { get } from 'svelte/store';
export async function logout(menuOpen: boolean) { export async function logout(menuOpen: boolean) {
try { try {
const req = await fetch($apiBase + '/api/auth/logout', { const req = await fetch(get(apiBase) + '/api/auth/logout', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${$sesionStore.accessToken}` Authorization: `Bearer ${get(sesionStore)?.accessToken}`
}, },
credentials: 'include' credentials: 'include'
}); });