[feat] loading inventory

This commit is contained in:
2026-04-03 22:10:41 -04:00
parent 86da8a91ad
commit 03394d81e8
3 changed files with 19 additions and 17 deletions

View File

@@ -145,16 +145,11 @@ export const POST: APIRoute = async ({ request, locals }) => {
break;
default:
return new Response(
'Invalid action',
{
status: 400,
headers: { 'Content-Type': 'text/html' }
}
);
// No action = list inventory for this card
return getInventory(userId!, cardId);
}
// Always return current inventory
// Always return current inventory after a mutation
return getInventory(userId!, cardId);

View File

@@ -500,17 +500,9 @@ const altSearchUrl = (card: any) => {
</div>
<!-- Inventory list -->
<div class="d-flex flex-column gap-3" id="inventoryEntryList" hx-post="/api/inventory" hx-trigger="intersect once" hx-target="this" hx-vals=`{"cardId": ${cardId}}`>
<div class="d-flex flex-column gap-3" id="inventoryEntryList" data-card-id={cardId}>
<span>Loading...</span>
</div>
<script is:inline>
console.log('Setting up inventory tooltips');
document.addEventListener('DOMContentLoaded', () => {
console.log('Initializing tooltips');
htmx.process(document.getElementById('inventoryEntryList'));
console.log('Tooltips initialized');
});
</script>
</div>
</div>
</div>