Added useApi hook.
This commit is contained in:
@@ -8,7 +8,7 @@ import FormLayout, {
|
||||
FormMessage,
|
||||
FormRow,
|
||||
} from 'components/layout/FormLayout';
|
||||
import usePost from 'hooks/usePost';
|
||||
import useApi from 'hooks/useApi';
|
||||
|
||||
const initialValues = {
|
||||
current_password: '',
|
||||
@@ -37,11 +37,11 @@ const validate = ({ current_password, new_password, confirm_password }) => {
|
||||
};
|
||||
|
||||
export default function ChangePasswordForm({ values, onSave, onClose }) {
|
||||
const post = usePost();
|
||||
const { post } = useApi();
|
||||
const [message, setMessage] = useState();
|
||||
|
||||
const handleSubmit = async values => {
|
||||
const { ok, data } = await post('/api/account/password', values);
|
||||
const { ok, data } = await post('/account/password', values);
|
||||
|
||||
if (ok) {
|
||||
onSave();
|
||||
|
||||
Reference in New Issue
Block a user