mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
feat: implement mobile-optimized DLC management page with EAN lookup and status-based filtering
This commit is contained in:
1 parent
475c52cede
commit
1488accbdb
3 files changed
+21
-2
No files matched your search
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user