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
|
- Source:
updateUser(updatedUser)
Updates an existing user in the localStorage database.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
updatedUser |
Object | The user object with updated information.
Properties
|
- Source: