Skip to content

Commit 1448443

Browse files
authored
Fix/control panel cache issue (#329)
* fix: evoting groups * chore: evault cache issue
1 parent 2ef0bc9 commit 1448443

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

infrastructure/control-panel/src/routes/+page.svelte

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,26 @@
158158
try {
159159
isLoading = true;
160160
error = null;
161+
console.log('🔍 Fetching eVaults...');
161162
const data = await EVaultService.getEVaults();
162-
evaults = data;
163+
console.log('📦 Data received:', data);
164+
console.log('📊 Data type:', typeof data);
165+
console.log('📊 Is array:', Array.isArray(data));
166+
167+
// Ensure data is an array
168+
if (Array.isArray(data)) {
169+
evaults = data;
170+
console.log('✅ eVaults set:', evaults.length, 'items');
171+
} else {
172+
console.error('❌ Expected array but got:', typeof data, data);
173+
evaults = [];
174+
error = 'Invalid data format received from server';
175+
return;
176+
}
163177
164178
// Map the data after fetching
165179
try {
166-
const mapped = data.map((evault) => {
180+
const mapped = evaults.map((evault) => {
167181
const mapped = {
168182
eName: {
169183
type: 'text',
@@ -190,17 +204,19 @@
190204
});
191205
192206
mappedData = mapped;
207+
console.log('✅ Data mapped successfully:', mappedData.length, 'items');
193208
} catch (mappingError) {
194-
console.error('Error mapping data:', mappingError);
209+
console.error('Error mapping data:', mappingError);
195210
error =
196211
'Error mapping data: ' +
197212
(mappingError instanceof Error ? mappingError.message : String(mappingError));
198213
}
199214
} catch (err) {
200215
error = 'Failed to fetch eVaults';
201-
console.error('Error fetching eVaults:', err);
216+
console.error('Error fetching eVaults:', err);
202217
} finally {
203218
isLoading = false;
219+
console.log('🏁 Fetch completed, loading set to false');
204220
}
205221
};
206222

0 commit comments

Comments
 (0)