Optimize login
This commit is contained in:
@@ -16,7 +16,8 @@ const Login: React.FC = () => {
|
|||||||
|
|
||||||
const onFinish = (values: LoginForm) => {
|
const onFinish = (values: LoginForm) => {
|
||||||
setIsLoggingIn(true)
|
setIsLoggingIn(true)
|
||||||
void login(values.username, values.password).then((value) => {
|
void login(values.username, values.password)
|
||||||
|
.then((value) => {
|
||||||
const res = value.data
|
const res = value.data
|
||||||
const { code, data } = res
|
const { code, data } = res
|
||||||
switch (code) {
|
switch (code) {
|
||||||
@@ -53,6 +54,9 @@ const Login: React.FC = () => {
|
|||||||
setIsLoggingIn(false)
|
setIsLoggingIn(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
setIsLoggingIn(false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { message } from 'antd'
|
|||||||
|
|
||||||
const service: AxiosInstance = axios.create({
|
const service: AxiosInstance = axios.create({
|
||||||
baseURL: import.meta.env.VITE_API_URL,
|
baseURL: import.meta.env.VITE_API_URL,
|
||||||
timeout: 10000,
|
timeout: 30000,
|
||||||
withCredentials: false
|
withCredentials: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user