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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user