Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | 1x 1x 1x 1x 1x 1x 32x 32x 32x 32x 3x 29x 29x 32x 32x 32x 32x 32x 32x 18x 3x 32x 4x 2x 4x | <template>
<NotificationContainer />
</template>
<script setup>
import { onMounted, onUnmounted } from 'vue';
import { useRoute } from 'vue-router';
import { useStore } from 'vuex';
import NotificationContainer from '../../../components/NotificationContainer';
import { NOTIF_FQ } from '../../../store/types';
import { AUTH_ERROR_TYPES } from '../../../utils/errorUtils';
const route = useRoute();
const store = useStore();
let redirectTimeout = null;
function getErrorMessage(errorType, customMessage) {
if (customMessage) {
return customMessage;
}
const messages = {
authentication_failed:
'We could not authenticate your credentials. Please try logging in again.',
auth_failed: 'Authentication failed. Please try again.',
invalid_credentials:
'The credentials provided are invalid. Please check and try again.',
token_expired: 'Your session has expired. Please log in again.',
session_expired: 'Your session has expired. Please log in again.',
state_mismatch: 'Security validation failed. Please try logging in again.',
invalid_callback:
'Invalid authentication callback. Please try logging in again.',
oidc_error: 'An error occurred during authentication. Please try again.',
missing_verifier:
'Session expired during authentication. Please try again.',
unknown_error: 'An unexpected error occurred. Please try again.',
service_unavailable:
'The service is temporarily unavailable. Please try again in a few moments.',
server_error: 'An unexpected error occurred. Please try again.',
};
return messages[errorType] || messages.unknown_error;
}
onMounted(() => {
const errorType = route.query.error || 'unknown_error';
const errorMessage = route.query.message
? decodeURIComponent(route.query.message)
: '';
const isAuthError = AUTH_ERROR_TYPES.includes(errorType);
store.dispatch(NOTIF_FQ.actions.showError, {
message: getErrorMessage(errorType, errorMessage),
type: errorType,
closable: true,
});
if (isAuthError) {
redirectTimeout = setTimeout(() => {
window.location.href = '/auth/login';
}, 5000);
}
});
onUnmounted(() => {
if (redirectTimeout) {
clearTimeout(redirectTimeout);
}
store.dispatch(NOTIF_FQ.actions.clear);
});
</script>
|