登录页面初步

This commit is contained in:
禺狨 2023-03-02 17:52:54 +08:00
parent 04c3fb3851
commit 0dad3f206e
4 changed files with 9 additions and 19 deletions

View File

@ -10,6 +10,9 @@ export class HttpClient {
baseURL: url, baseURL: url,
timeout: 15000, timeout: 15000,
withCredentials: false, withCredentials: false,
headers:{
"Accept":"application/json"
}
}); });
//拦截器注册 //拦截器注册

View File

@ -17,3 +17,7 @@ export function login(
export function logout() { export function logout() {
return client.post("/backend/v1/auth/logout", {}); return client.post("/backend/v1/auth/logout", {});
} }
export function getUser() {
return client.get("/backend/v1/auth/detail", {});
}

View File

@ -4,7 +4,3 @@ export function getImageCaptcha() {
return client.get("/backend/v1/system/image-captcha", {}); return client.get("/backend/v1/system/image-captcha", {});
} }
export function getUser() {
return client.get("/backend/v1/auth/detail", {});
}

View File

@ -57,7 +57,7 @@ export const Login: React.FC = (defaultState) => {
}; };
const getUser = () => { const getUser = () => {
system.getUser().then((res) => { login.getUser().then((res) => {
console.log(res); console.log(res);
}); });
}; };
@ -65,20 +65,7 @@ export const Login: React.FC = (defaultState) => {
useEffect(() => { useEffect(() => {
fetchData(); fetchData();
}, []); }, []);
if (loading) {
return (
<Spin
size="large"
style={{
marginTop: 200,
marginBottom: 200,
marginLeft: "auto",
marginRight: "auto",
width: "100%",
}}
/>
);
}
return ( return (
<div className={styles["login-content"]}> <div className={styles["login-content"]}>
<div className={styles["login-box"]}> <div className={styles["login-box"]}>