fix(myTischtennis): improve error handling for Playwright login and account verification

- Enhanced error handling in MyTischtennisClient and MyTischtennisService to provide clearer feedback when browser executables are missing.
- Updated responses to include specific error messages and status codes, improving user guidance for setup requirements.
- Refactored MyTischtennisDialog and MyTischtennisAccount components to handle API response errors more effectively, ensuring robust login and account management processes.
This commit is contained in:
Torsten Schulz (local)
2026-02-27 17:23:03 +01:00
parent 4e81a1c4a7
commit 12bba26ff1
4 changed files with 37 additions and 10 deletions

View File

@@ -170,9 +170,14 @@ export default {
this.error = null;
this.saving = true;
try {
await apiClient.post('/mytischtennis/verify', {
const response = await apiClient.post('/mytischtennis/verify', {
password: this.formData.password
});
if (response.status >= 400 || response?.data?.success === false) {
const requestError = new Error('myTischtennis verify failed');
requestError.response = response;
throw requestError;
}
this.$emit('logged-in');
} catch (error) {
console.error('Fehler beim Login:', error);
@@ -203,7 +208,12 @@ export default {
payload.userPassword = this.formData.userPassword;
}
await apiClient.post('/mytischtennis/account', payload);
const response = await apiClient.post('/mytischtennis/account', payload);
if (response.status >= 400 || response?.data?.success === false) {
const requestError = new Error('myTischtennis account save failed');
requestError.response = response;
throw requestError;
}
this.$emit('saved');
} catch (error) {
console.error('Fehler beim Speichern:', error);

View File

@@ -233,7 +233,12 @@ export default {
};
try {
// 1-Klick-Re-Login: zuerst gespeicherte Session/Passwort serverseitig verwenden
await apiClient.post('/mytischtennis/verify', {});
const response = await apiClient.post('/mytischtennis/verify', {});
if (response.status >= 400 || response?.data?.success === false) {
const requestError = new Error('myTischtennis verify failed');
requestError.response = response;
throw requestError;
}
await this.loadAccount();
this.loginFeedback = {
type: 'success',