forked from boolean-uk/team-dev-client-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Requirement:
user should be able to type into search box on top bar and search for other users by name.
Component:
search bar exists already in pages/dashboard/index.js.
Logic:
- user can type name or set of names split by space
- when search bar not empty, search button enables and changes visuals (i.e. change color)
- current search text stored in state (this is already enabled)
- search should occur when user clicks search or hits enter.
Search requirements:
- needs event handler to trigger search when above actions are taken.
- sends GET request to /users?search={string}
- use state variable in same file as event handler to track isSearching, default is false, when search happens it should change to true. search should check this variable to ensure it is false before searching to avoid simultaneous searches.
- while isSearching is set to true, search button should be disabled again to prevent more searches being sent.
Errors:
- if error occurs, change isSearching to false.
- error can be displayed using an alert or similar message.
On success:
- isSearching should be set to false.
- results stored in state, using context so they can be used by the results page as well.
- user is navigated to a results page (issue Create search results page (student view) #27)
Reactions are currently unavailable