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