Actualiser js/admin.js
This commit is contained in:
+2
-2
@@ -397,7 +397,7 @@ async function handleCritiqueUpload(input) {
|
|||||||
for (let i = 0; i < allData.length; i += 3) {
|
for (let i = 0; i < allData.length; i += 3) {
|
||||||
const batch = allData.slice(i, i + 3);
|
const batch = allData.slice(i, i + 3);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_URL}?action=import_batch`, { method: 'POST', headers: { 'Authorization': localStorage.getItem('token'), 'Content-Type': 'application/json' }, body: JSON.stringify({ items: batch, type: 'critique' }) });
|
const response = await fetch(`${API_URL}?action=import_batch`, { method: 'POST', headers: { 'Authorization': localStorage.getItem('token'), 'Content-Type': 'application/json' }, body: JSON.stringify({ items: batch, type: 'critique' }) });
|
||||||
if (!response.ok) throw new Error(`Erreur serveur ${response.status}`);
|
if (!response.ok) throw new Error(`Erreur serveur ${response.status}`);
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
if (!result.success) throw new Error(result.error || "Erreur inconnue.");
|
if (!result.success) throw new Error(result.error || "Erreur inconnue.");
|
||||||
@@ -550,7 +550,7 @@ async function submitEan() {
|
|||||||
showImportModal(1, 'videotheque');
|
showImportModal(1, 'videotheque');
|
||||||
document.getElementById('import-modal-desc').textContent = "Récupération des infos et de la jaquette...";
|
document.getElementById('import-modal-desc').textContent = "Récupération des infos et de la jaquette...";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${API_URL}?action=add_item_by_ean`, {
|
const response = await fetch(`${API_URL}?action=add_item_by_ean`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Authorization': localStorage.getItem('token'), 'Content-Type': 'application/json' },
|
headers: { 'Authorization': localStorage.getItem('token'), 'Content-Type': 'application/json' },
|
||||||
|
|||||||
Reference in New Issue
Block a user