Files
Inventory-Manager/public/javascripts/inventory.js
T
2025-01-12 02:38:12 +00:00

18 lines
555 B
JavaScript

async function syncInventory() {
}
document.querySelector('#syncInventory').addEventListener('click', async () => {
try {
const response = await fetch('/api/inventory/sync', { method: 'POST' });
const result = await response.json();
alert(result.message);
location.reload(); // Refresh page after sync
} catch (error) {
alert('Error syncing inventory: ' + error.message);
}
})
document.querySelector('#newSku').addEventListener('click', () => {
window.location.href = '/inventory/add-sku';
})