Constructor
new UserDataAccess()
Initializes the UserDataAccess instance. Checks if the 'userData' key exists
in localStorage. If not, it initializes it with dummy data.
- Source:
Methods
deleteUser(id)
Deletes a user by their unique ID from the localStorage database.
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 the localStorage database.
- Source:
Returns:
The array of users.
- Type
- Array.<{id: number, firstName: string, lastName: string, email: string}>
getUserById(id) → (nullable) {Object}
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, otherwise null.
- Type
- Object
insertUser(newUser)
Inserts a new user into the localStorage database.
Parameters:
Name | Type | Description |
---|---|---|
newUser |
Object | The new user to insert. |
- Source:
updateUser(updatedUser)
Updates an existing user in the localStorage database.
Parameters:
Name | Type | Description |
---|---|---|
updatedUser |
Object | The user object with updated values. |
- Source: