Constructor
new UserDataAccess()
Creates an instance of UserDataAccess.
Initializes the localStorage database with dummy data if not present.
- Source:
Methods
deleteUser(id)
Deletes a user from the localStorage database.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The ID of the user to delete. |
- Source:
getAllUsers() → {Array.<Object>}
Retrieves all users from the localStorage database.
- Source:
Returns:
An array of user objects.
- Type
- Array.<Object>
getUserById(id) → {Object|null}
Retrieves a user by their ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The ID of the user. |
- Source:
Returns:
The user object if found, otherwise null.
- Type
- Object | null
insertUser(newUser)
Inserts a new user into the localStorage database.
Parameters:
Name | Type | Description |
---|---|---|
newUser |
Object | The new user object. |
- Source:
updateUser(updatedUser)
Updates an existing user in the localStorage database.
Parameters:
Name | Type | Description |
---|---|---|
updatedUser |
Object | The updated user object. |
- Source: