Implement missing sample data loading and one-time use security
- Fix UI to load server-hosted sample data at startup as per specification - Add one-time use security: server clears sample data after retrieval - Ensure React app periodically checks for new sample data availability - Remove complex same-origin protection in favor of simpler one-time use model - Improve data security by preventing data persistence after consumption
This commit is contained in:
@@ -51,7 +51,13 @@ function createApp() {
|
||||
|
||||
app.get('/api/v1/sample', (req, res) => {
|
||||
try {
|
||||
res.json(sampleData);
|
||||
const dataToReturn = sampleData;
|
||||
|
||||
// Security: Clear the sample data after it's retrieved (one-time use)
|
||||
sampleData = null;
|
||||
console.log('📤 Sample data retrieved and cleared from server memory');
|
||||
|
||||
res.json(dataToReturn);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to retrieve sample data' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user