Refactored useApi usage.

This commit is contained in:
Mike Cao committed 2022-12-27 20:20:44 -08:00
1 parent 561cde6e7e
commit cad0b73e42
26 files changed
+67 -85

No files matched your search

+3 -3
View File
@@ -1,13 +1,13 @@
import { useMutation } from '@tanstack/react-query';
import { getAuthToken } from 'lib/client';
import { useApi } from 'next-basics';
import { getClientAuthToken } from 'lib/client';
import useApi from 'hooks/useApi';
import { Button, Form, FormButtons, FormInput, SubmitButton, TextField } from 'react-basics';
import styles from './Form.module.css';
const CONFIRM_VALUE = 'DELETE';
export default function UserDeleteForm({ userId, onSave, onClose }) {
const { del } = useApi(getAuthToken());
const { del } = useApi(getClientAuthToken());
const { mutate, error, isLoading } = useMutation(data => del(`/users/${userId}`, data));
const handleSubmit = async data => {