feat: implement mobile-optimized DLC management page with EAN lookup and status-based filtering

This commit is contained in:
Michael committed 2026-04-02 09:28:46 +02:00
1 parent 475c52cede
commit 1488accbdb
3 files changed
+21 -2

No files matched your search

+1 -1
View File
@@ -128,7 +128,7 @@ export default function DlcPage() {
eanDebounceRef.current = setTimeout(async () => {
setEanLookupLoading(true);
try {
const res = await fetch(`https://api.ffnancy.fr/api/articles?ean=${encodeURIComponent(gencodeValue)}&limit=1`);
const res = await fetch(`/api/ffnancy/articles?ean=${encodeURIComponent(gencodeValue)}&limit=1`, { credentials: 'include' });
if (!res.ok) return;
const data = await res.json();
const article = data.articles?.[0];
+1 -1
View File
@@ -153,7 +153,7 @@ export default function MobileDlcPage() {
eanDebounceRef.current = setTimeout(async () => {
setEanLookupLoading(true);
try {
const res = await fetch(`https://api.ffnancy.fr/api/articles?ean=${encodeURIComponent(gencodeValue)}&limit=1`);
const res = await fetch(`/api/ffnancy/articles?ean=${encodeURIComponent(gencodeValue)}&limit=1`, { credentials: 'include' });
if (!res.ok) return;
const data = await res.json();
const article = data.articles?.[0];
+19
View File
@@ -6031,6 +6031,25 @@ RÉSUMÉ DU SCAN
}
});
// Proxy API ffnancy - évite les problèmes CORS côté navigateur
app.get('/api/ffnancy/articles', requireAuth, async (req: Request, res: Response) => {
try {
const params = new URLSearchParams();
const allowed = ['search', 'codein', 'ean', 'codefou', 'actif', 'page', 'limit'];
for (const key of allowed) {
if (req.query[key]) params.append(key, req.query[key] as string);
}
const response = await fetch(`https://api.ffnancy.fr/api/articles?${params}`);
if (!response.ok) {
return res.status(response.status).json({ error: 'API ffnancy error' });
}
const data = await response.json();
res.json(data);
} catch (error) {
res.status(500).json({ error: 'Failed to reach API ffnancy' });
}
});
// Create server instance
const httpServer = createServer(app);