Refactored useApi usage.

This commit is contained in:
Mike Cao 2022-12-27 20:20:44 -08:00
parent 561cde6e7e
commit cad0b73e42
26 changed files with 67 additions and 85 deletions

View file

@ -3,15 +3,15 @@ import PageHeader from 'components/layout/PageHeader';
import UsersTable from 'components/tables/UsersTable';
import { useState } from 'react';
import { Button, Icon, useToast } from 'react-basics';
import { getAuthToken } from 'lib/client';
import { getClientAuthToken } from 'lib/client';
import { useMutation } from '@tanstack/react-query';
import { useApi } from 'next-basics';
import useApi from 'hooks/useApi';
export default function UsersList() {
const [loading, setLoading] = useState(false);
const [error, setError] = useState();
const { toast, showToast } = useToast();
const { post } = useApi(getAuthToken());
const { post } = useApi(getClientAuthToken());
const { mutate, isLoading } = useMutation(data => post('/api-key', data));
const handleSave = () => {