Fixed mutate queries.

This commit is contained in:
Mike Cao 2023-12-03 21:35:20 -08:00
parent e462a55ab9
commit a4f8ab6ad9
4 changed files with 20 additions and 14 deletions

View file

@ -6,7 +6,9 @@ import useMessages from 'components/hooks/useMessages';
export function PasswordEditForm({ onSave, onClose }) {
const { formatMessage, labels, messages } = useMessages();
const { post, useMutation } = useApi();
const { mutate, error, isLoading } = useMutation((data: any) => post('/me/password', data));
const { mutate, error, isPending } = useMutation({
mutationFn: (data: any) => post('/me/password', data),
});
const ref = useRef(null);
const handleSubmit = async (data: any) => {
@ -56,7 +58,7 @@ export function PasswordEditForm({ onSave, onClose }) {
</FormInput>
</FormRow>
<FormButtons flex>
<Button type="submit" variant="primary" disabled={isLoading}>
<Button type="submit" variant="primary" disabled={isPending}>
{formatMessage(labels.save)}
</Button>
<Button onClick={onClose}>{formatMessage(labels.cancel)}</Button>