Constructor
new UserDataAccess()
Initializes the UserDataAccess instance. Checks if the "userData" key exists in localStorage,
if not, initializes it with the dummy data.
- Source:
Methods
deleteUser(id)
Deletes a user from the localStorage database by their 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:
List of users.
- Type
- Array.<{id: number, firstName: string, lastName: string, email: string}>
getUserById(id) → {Object|null}
Retrieves a user by their ID from localStorage.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The ID of the user to retrieve. |
- Source:
Returns:
The user object if found, else null.
- Type
- Object | null
insertUser(newUser)
Inserts a new user into the localStorage database.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
newUser |
Object | The 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 to update.
Properties
|
- Source: