- updated zustand and react libraries;
- added 'put in draft' btn;
This commit is contained in:
@@ -3,7 +3,7 @@ import { __ } from '@wordpress/i18n';
|
||||
import { useForm } from 'react-hook-form';
|
||||
|
||||
// store
|
||||
import { storeSet, useStore } from '../../store';
|
||||
import { storeSet, useStoreValue } from '../../store';
|
||||
|
||||
// components
|
||||
import set404FromErrorResponse from '../../helpers/set404FromErrorResponse';
|
||||
@@ -18,8 +18,8 @@ import UserService from '../../service/user-service';
|
||||
import getDateFromISOstring from '../../helpers/getDateFromISOstring';
|
||||
|
||||
const ProfileBeneficiario = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const userData = useStore().main.userData();
|
||||
const isAsyncRequest = useStoreValue('isAsyncRequest');
|
||||
const userData = useStoreValue('userData');
|
||||
const toast = useRef(null);
|
||||
|
||||
const {
|
||||
@@ -34,14 +34,14 @@ const ProfileBeneficiario = () => {
|
||||
});
|
||||
|
||||
const onSubmit = (formData) => {
|
||||
storeSet.main.setAsyncRequest();
|
||||
storeSet('setAsyncRequest');
|
||||
|
||||
UserService.updateUserSelf(userData.id, formData, updateCallback, updateError);
|
||||
};
|
||||
|
||||
const updateCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
storeSet.main.userData(data.data);
|
||||
storeSet('userData', data.data);
|
||||
if (toast.current) {
|
||||
toast.current.show({
|
||||
severity: 'success',
|
||||
@@ -50,12 +50,12 @@ const ProfileBeneficiario = () => {
|
||||
});
|
||||
}
|
||||
}
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
const updateError = (data) => {
|
||||
set404FromErrorResponse(data);
|
||||
storeSet.main.unsetAsyncRequest();
|
||||
storeSet('unsetAsyncRequest');
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user