mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 15:15:24 +02:00
Add column resizing in Pricing table
Drag column borders to resize width like Excel
This commit is contained in:
+8
-15
@@ -31,36 +31,29 @@ export default async function handler(req, res) {
|
||||
|
||||
if (req.method === 'GET' && req.query.info === '1') {
|
||||
try {
|
||||
const fileInfo = await fetch('https://api.dropboxapi.com/2/files/get_metadata', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ path: '/CRAZE GmbH/Sales Reports/Data Matrix.xlsx' })
|
||||
});
|
||||
const data = await fileInfo.json();
|
||||
// In this mode, we'll just return a placeholder rev since we're using a sharing link now
|
||||
// This satisfies the frontend check without needing a specific API path
|
||||
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
||||
res.setHeader('Pragma', 'no-cache');
|
||||
res.setHeader('Expires', '0');
|
||||
return res.json({ rev: data.rev, size: data.size, server_modified: data.server_modified });
|
||||
return res.json({ rev: 'new-url-v1', size: 0, server_modified: new Date().toISOString() });
|
||||
} catch (err) {
|
||||
return res.status(500).json({ error: err.message });
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const upstream = await fetch('https://content.dropboxapi.com/2/files/download', {
|
||||
method: 'POST',
|
||||
const sharingUrl = 'https://www.dropbox.com/scl/fi/ulcgt5iyyvrkeynprhali/Data-Matrix.xlsx?rlkey=i9p9xgwzm0fr7jip91vxdeal5&st=k8jmibh4&dl=1';
|
||||
const upstream = await fetch(sharingUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Dropbox-API-Arg': JSON.stringify({ path: '/CRAZE GmbH/Sales Reports/Data Matrix.xlsx' })
|
||||
'Cache-Control': 'no-cache'
|
||||
}
|
||||
});
|
||||
|
||||
if (!upstream.ok) {
|
||||
const errText = await upstream.text();
|
||||
console.error('Dropbox API error:', upstream.status, errText);
|
||||
console.error('Dropbox URL error:', upstream.status, errText);
|
||||
return res.status(upstream.status).send('Dropbox error: ' + errText);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user