feat: finished settings page

This commit is contained in:
canove
2020-09-04 10:35:34 -03:00
parent bc376e2b1c
commit e4e918ab90
5 changed files with 111 additions and 41 deletions

View File

@@ -53,9 +53,10 @@ const reducer = (state, action) => {
if (contactIndex !== -1) {
state[contactIndex] = contact;
return [...state];
} else {
return [contact, ...state];
}
return [contact, ...state];
}
if (action.type === "DELETE_CONTACT") {
@@ -67,6 +68,10 @@ const reducer = (state, action) => {
}
return [...state];
}
if (action.type === "RESET") {
return [];
}
};
const useStyles = makeStyles(theme => ({
@@ -91,6 +96,11 @@ const Contacts = () => {
const [confirmOpen, setConfirmOpen] = useState(false);
const [hasMore, setHasMore] = useState(false);
useEffect(() => {
dispatch({ type: "RESET" });
setPageNumber(1);
}, [searchParam]);
useEffect(() => {
setLoading(true);
const delayDebounceFn = setTimeout(() => {