mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
Added useApi hook.
This commit is contained in:
parent
7bd49e6caf
commit
d19b6b5a82
22 changed files with 59 additions and 59 deletions
|
|
@ -10,7 +10,7 @@ import FormLayout, {
|
|||
FormRow,
|
||||
} from 'components/layout/FormLayout';
|
||||
import Icon from 'components/common/Icon';
|
||||
import usePost from 'hooks/usePost';
|
||||
import useApi from 'hooks/useApi';
|
||||
import { setItem } from 'lib/web';
|
||||
import { AUTH_TOKEN } from 'lib/constants';
|
||||
import { setUser } from 'store/app';
|
||||
|
|
@ -31,12 +31,12 @@ const validate = ({ username, password }) => {
|
|||
};
|
||||
|
||||
export default function LoginForm() {
|
||||
const post = usePost();
|
||||
const { post } = useApi();
|
||||
const router = useRouter();
|
||||
const [message, setMessage] = useState();
|
||||
|
||||
const handleSubmit = async ({ username, password }) => {
|
||||
const { ok, status, data } = await post('/api/auth/login', {
|
||||
const { ok, status, data } = await post('/auth/login', {
|
||||
username,
|
||||
password,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue