Refactor global error handling in server and improve logging in myTischtennisService
This commit moves the global error handling middleware in server.js to ensure it is applied after all routes. It also enhances the error handling in myTischtennisService by adding detailed logging for login attempts and failures, improving the visibility of issues during the login process. Additionally, the decryptData function in encrypt.js is updated to check if data is already decrypted, enhancing its robustness. Frontend changes include a minor adjustment to the button type in MyTischtennisAccount.vue for better accessibility.
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
|
||||
<div class="button-group">
|
||||
<button class="btn-primary" @click="openEditDialog">{{ $t('myTischtennisAccount.editAccount') }}</button>
|
||||
<button class="btn-secondary" @click="testConnection">{{ $t('myTischtennisAccount.loginAgain') }}</button>
|
||||
<button type="button" class="btn-secondary" @click="testConnection">{{ $t('myTischtennisAccount.loginAgain') }}</button>
|
||||
<button class="btn-info" @click="openHistoryDialog" v-if="account">{{ $t('myTischtennisAccount.updateHistory') }}</button>
|
||||
<button class="btn-danger" @click="deleteAccount">{{ $t('myTischtennisAccount.unlinkAccount') }}</button>
|
||||
</div>
|
||||
@@ -287,14 +287,17 @@ export default {
|
||||
},
|
||||
|
||||
async testConnection() {
|
||||
console.log('[testConnection] Starting connection test...');
|
||||
try {
|
||||
await apiClient.post('/mytischtennis/verify');
|
||||
const response = await apiClient.post('/mytischtennis/verify');
|
||||
console.log('[testConnection] Response:', response);
|
||||
this.$store.dispatch('showMessage', {
|
||||
text: this.$t('myTischtennisAccount.loginSuccessful'),
|
||||
type: 'success'
|
||||
});
|
||||
await this.loadAccount(); // Aktualisiere Account-Daten inkl. clubId, fedNickname
|
||||
} catch (error) {
|
||||
console.error('[testConnection] Error:', error);
|
||||
const message = getSafeErrorMessage(error, 'Login fehlgeschlagen');
|
||||
|
||||
if (error.response?.status === 400 && message.includes('Kein Passwort gespeichert')) {
|
||||
|
||||
Reference in New Issue
Block a user