generated from goitacademy/react-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from iVladyuser/accounts
added contactThunk and logic
- Loading branch information
Showing
13 changed files
with
115 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { createSelector } from '@reduxjs/toolkit'; | ||
|
||
export const selectContacts = state => state.contactsStore.contacts; | ||
export const selectContactsIsLoading = state => state.contactsStore.isLoading; | ||
export const selectContactsError = state => state.contactsStore.error; | ||
export const selectContactsFilterTerm = state => state.filterStore.filterTerm; | ||
export const selectContacts = state => state.phoneBook.contacts; | ||
export const selectContactsIsLoading = state => state.phoneBook.isLoading; | ||
export const selectContactsError = state => state.phoneBook.error; | ||
export const selectContactsFilterTerm = state => state.filter.filterTerm; | ||
|
||
export const selectFilteredContacts = createSelector( | ||
[selectContacts, selectContactsFilterTerm], | ||
(contacts, filterTerm) => | ||
contacts.filter( | ||
contact => | ||
contact.name.toLowerCase().includes(filterTerm.toLowerCase().trim()) || | ||
contact.phone.toString().includes(filterTerm.toLowerCase().trim()) | ||
contact.number.toString().includes(filterTerm.toLowerCase().trim()) | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * as contactsSelectors from './contactsSelectors'; | ||
export * as contactsSlices from './phoneBookSlice'; | ||
export * as contactsSlice from './phoneBookSlice'; | ||
export * as filterSlice from './filterSlice'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.