Constructor
new UserDataAccess()
Initializes the UserDataAccess instance.
Checks if 'userData' is already 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.<Object>}
Retrieves all users from the localStorage.
- Source:
Returns:
List of all users in localStorage.
- Type
- Array.<Object>
getUserById(id) → {Object|null}
Retrieves a user by their unique ID.
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 user object to insert.
Properties
|
- Source:
updateUser(updatedUser)
Updates an existing user's data in the localStorage database.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
updatedUser |
Object | The user object with updated data.
Properties
|
- Source: