mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Support basePath in all queries.
This commit is contained in:
parent
2508198a51
commit
5068ab12a9
11 changed files with 57 additions and 29 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { Formik, Form, Field } from 'formik';
|
||||
import Router from 'next/router';
|
||||
import { useRouter } from 'next/router';
|
||||
import { post } from 'lib/web';
|
||||
import Button from 'components/common/Button';
|
||||
import FormLayout, {
|
||||
|
|
@ -28,13 +28,17 @@ const validate = ({ username, password }) => {
|
|||
};
|
||||
|
||||
export default function LoginForm() {
|
||||
const router = useRouter();
|
||||
const [message, setMessage] = useState();
|
||||
|
||||
const handleSubmit = async ({ username, password }) => {
|
||||
const { ok, status, data } = await post('/api/auth/login', { username, password });
|
||||
const { ok, status, data } = await post(`${router.basePath}/api/auth/login`, {
|
||||
username,
|
||||
password,
|
||||
});
|
||||
|
||||
if (ok) {
|
||||
await Router.push('/');
|
||||
return router.push('/');
|
||||
} else {
|
||||
setMessage(
|
||||
status === 401 ? (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue