mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-10 01:39:54 +03:00
default Alova v2
This commit is contained in:
@@ -5,7 +5,8 @@ import ForwardIcon from '@mui/icons-material/Forward';
|
||||
import { Box, Button, Paper, Typography } from '@mui/material';
|
||||
|
||||
import * as AuthenticationApi from 'components/routing/authentication';
|
||||
import { useRequest } from 'alova/client';
|
||||
// import { useRequest } from 'alova/client' // TODO replace when Alova 3 is released
|
||||
import { useRequest } from 'alova';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
import {
|
||||
LanguageSelector,
|
||||
@@ -31,12 +32,26 @@ const SignIn = () => {
|
||||
const [processing, setProcessing] = useState<boolean>(false);
|
||||
const [fieldErrors, setFieldErrors] = useState<ValidateFieldsError>();
|
||||
|
||||
const { send: callSignIn } = useRequest(
|
||||
// TODO ALova 3 code...
|
||||
// const { send: callSignIn } = useRequest(
|
||||
// (request: SignInRequest) => AuthenticationApi.signIn(request),
|
||||
// {
|
||||
// immediate: false
|
||||
// }
|
||||
// ).onSuccess((response) => {
|
||||
// if (response.data) {
|
||||
// authenticationContext.signIn(response.data.access_token);
|
||||
// }
|
||||
// });
|
||||
|
||||
const { send: callSignIn, onSuccess } = useRequest(
|
||||
(request: SignInRequest) => AuthenticationApi.signIn(request),
|
||||
{
|
||||
immediate: false
|
||||
}
|
||||
).onSuccess((response) => {
|
||||
);
|
||||
|
||||
onSuccess((response) => {
|
||||
if (response.data) {
|
||||
authenticationContext.signIn(response.data.access_token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user