Header Component¶
The Header component is a reusable navigation bar that provides user-related actions such as language selection, password change, and logout. It also displays the current user's information.
Purpose and Utility¶
The Header component is designed to provide a consistent navigation experience across the application. It includes:
- Language selection for localization.
- User information display.
- Options to change the user's password.
- Logout functionality.
Example Usage¶
The Header component is used in the Layout component to provide a top navigation bar:
<template>
<div>
<Header />
<!-- ...existing code... -->
</div>
</template>
Props and Data¶
Props¶
The Header component does not accept any props.
Data¶
locale: The current language locale.userData: Contains the user'susernameandname.infoMsg: A message displayed in the info modal.newPassword: An object containingcurrentPasswordandnewPasswordfor password change functionality.
Methods¶
checkLang: Checks and sets the current language based on cookies.esLangChange: Changes the language to Spanish.enLangChange: Changes the language to English.logout: Logs the user out and redirects to the login page.getMeInfo: Fetches the current user's information.showModal: Displays a modal by its ID.hideModal: Hides a modal by its ID.changePassword: Sends a request to change the user's password.
Modals¶
The Header component includes the following modals:
- Change Password Modal: Allows the user to change their password.
- Info Modal: Displays informational messages.
- Error Modal: Displays error messages.
Notes¶
- The
Headercomponent uses BootstrapVue for styling and functionality. - Language flags are displayed using assets located in the
assets/iconsdirectory.