fix: improve error handling for CSV import in upload and ScheduleView
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 51s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 51s
This commit is contained in:
@@ -16,7 +16,9 @@ export const uploadCSV = async (req, res) => {
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error importing CSV:', error);
|
||||
return res.status(500).json({ error: 'Failed to import CSV data' });
|
||||
return res.status(500).json({
|
||||
error: error.message || 'Failed to import CSV data'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2206,16 +2206,24 @@ export default {
|
||||
formData.append('clubId', this.currentClub);
|
||||
|
||||
try {
|
||||
await apiClient.post('/matches/import', formData, {
|
||||
const response = await apiClient.post('/matches/import', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
});
|
||||
if (response.status < 200 || response.status >= 300) {
|
||||
throw new Error(response.data?.error || 'Failed to import CSV data');
|
||||
}
|
||||
this.showInfo(this.$t('messages.success'), this.$t('schedule.scheduleImportSuccess'), '', 'success');
|
||||
this.closeImportModal();
|
||||
this.loadTeams();
|
||||
} catch (error) {
|
||||
this.showInfo(this.$t('messages.error'), this.$t('schedule.errorImportingCSV'), '', 'error');
|
||||
this.showInfo(
|
||||
this.$t('messages.error'),
|
||||
getSafeErrorMessage(error, this.$t('schedule.errorImportingCSV')),
|
||||
'',
|
||||
'error'
|
||||
);
|
||||
}
|
||||
},
|
||||
// Sortierfunktion für Ligen
|
||||
|
||||
Reference in New Issue
Block a user