Refactor politics routes and service: Removed duplicate route for open politics in falukantRouter, updated falukantService to enhance logging for age validation in political applications, and ensured proper handling of open politics data in PoliticsView. This improves code clarity and debugging capabilities.

This commit is contained in:
Torsten Schulz (local)
2026-02-06 00:04:49 +01:00
parent 6b96ee9856
commit 56c38c04aa
3 changed files with 11 additions and 12 deletions

View File

@@ -246,10 +246,14 @@ export default {
this.loading.openPolitics = true;
try {
const { data } = await apiClient.get('/api/falukant/politics/open');
this.openPolitics = data;
this.openPolitics = Array.isArray(data) ? data : [];
// Debug: Alters-Flag prüfen
if (this.openPolitics.length > 0) {
console.log('[PoliticsView] loadOpenPolitics: count=', this.openPolitics.length, 'first.canApplyByAge=', this.openPolitics[0].canApplyByAge, 'first.id=', this.openPolitics[0].id);
}
// Bereits beworbene Positionen vorselektieren, damit die Checkbox
// sichtbar markiert bleibt.
this.selectedApplications = data
this.selectedApplications = this.openPolitics
.filter(e => e.alreadyApplied)
.map(e => e.id);
} catch (err) {