fix: update clubId handling in CSV upload to support query parameters and improve form data processing
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 53s

This commit is contained in:
Torsten Schulz (local)
2026-07-17 14:02:54 +02:00
parent a767061bd3
commit bb9a030e89
2 changed files with 5 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import { emitScheduleMatchUpdated } from '../services/socketService.js';
import { devLog } from '../utils/logger.js';
export const uploadCSV = async (req, res) => {
try {
const { clubId } = req.body;
const clubId = req.body?.clubId ?? req.query?.clubId;
const { authcode: userToken} = req.headers;
const filePath = req.file.path;
const result = await MatchService.importCSV(userToken, clubId, filePath);

View File

@@ -2208,7 +2208,10 @@ export default {
try {
// Let the browser add the multipart boundary. Setting Content-Type manually
// drops it and prevents Multer from reading form fields such as clubId.
const response = await apiClient.post('/matches/import', formData);
const response = await apiClient.post(
`/matches/import?clubId=${encodeURIComponent(this.currentClub)}`,
formData
);
if (response.status < 200 || response.status >= 300) {
throw new Error(response.data?.error || 'Failed to import CSV data');
}