State management
This commit is contained in:
@@ -17,8 +17,9 @@ const PersonalizationSettings = () => {
|
||||
const [personal, setPersonal] = useState<PersonalData>();
|
||||
const [update, setUpdate] = useState<any>({});
|
||||
const [debounced] = useDebouncedValue(update, 1000);
|
||||
const { mutateAsync: editRow } = useMutationAPI();
|
||||
const { mutateAsync } = useMutationAPI();
|
||||
const { isMobile } = useCommonHooks();
|
||||
|
||||
useEffect(() => {
|
||||
if (personalData && personalIsFetched) {
|
||||
setPersonal(personalData[0]);
|
||||
@@ -28,7 +29,7 @@ const PersonalizationSettings = () => {
|
||||
useEffect(() => {
|
||||
if (Object.keys(debounced).length) {
|
||||
setPersonal(update);
|
||||
editRow({ method: 'PATCH', endpoint: endpoint, body: debounced });
|
||||
mutateAsync({ method: 'PATCH', endpoint: endpoint, body: debounced });
|
||||
setUpdate({});
|
||||
}
|
||||
}, [debounced]);
|
||||
@@ -61,6 +62,8 @@ const PersonalizationSettings = () => {
|
||||
searchValue={undefined}
|
||||
setSearchValue={() => {}}
|
||||
searchPlaceholder={undefined}
|
||||
isLoading={false}
|
||||
setIsLoading={() => {}}
|
||||
/>
|
||||
<Stack
|
||||
align='center'
|
||||
|
||||
Reference in New Issue
Block a user