Class: UserDataAccess

UserDataAccess()

Class representing user data access for managing user information in local storage.

Constructor

new UserDataAccess()

Creates an instance of UserDataAccess. Initializes the localStorage with dummy data if no user data exists.
Source:

Methods

deleteUser(id)

Deletes a user from the localStorage database by their unique ID.
Parameters:
Name Type Description
id number The ID of the user to delete.
Source:

getAllUsers() → {Array.<{id: number, firstName: string, lastName: string, email: string}>}

Retrieves all users from localStorage.
Source:
Returns:
An array of user objects.
Type
Array.<{id: number, firstName: string, lastName: string, email: string}>

getUserById(id) → {Object|null}

Retrieves a user by their unique ID from localStorage.
Parameters:
Name Type Description
id number The ID of the user to retrieve.
Source:
Returns:
The user object if found, or null if not found.
Type
Object | null

insertUser(newUser)

Inserts a new user into the localStorage database.
Parameters:
Name Type Description
newUser Object The new user object to insert.
Properties
Name Type Description
id number The unique ID for the user (will be set inside the method).
firstName string The first name of the user.
lastName string The last name of the user.
email string The email of the user.
Source:

updateUser(updatedUser)

Updates an existing user in the localStorage database.
Parameters:
Name Type Description
updatedUser Object The user object with updated information.
Properties
Name Type Description
id number The unique ID of the user to update.
firstName string The updated first name.
lastName string The updated last name.
email string The updated email.
Source: