Constructor
new UserDataAccess()
Initializes the UserDataAccess instance.
Ensures that local storage has the 'userData' key populated with dummy data if not already set.
- Source:
Methods
deleteUser(id)
Deletes a user by their ID from the local storage database.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The ID of the user to delete. |
- Source:
getAllUsers() → {Array.<Object>}
Retrieves all users from local storage.
- Source:
Returns:
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 to retrieve. |
- Source:
Returns:
The user object or null if not found.
- Type
- Object | null
insertUser(newUser)
Inserts a new user into the local storage database.
Parameters:
Name | Type | Description |
---|---|---|
newUser |
Object | The new user object to insert. |
- Source:
updateUser(updatedUser)
Updates an existing user in the local storage database.
Parameters:
Name | Type | Description |
---|---|---|
updatedUser |
Object | The user object with updated data. |
- Source: