更新认证API,新增地理位置参数支持,优化登录逻辑以处理位置获取,提升用户体验和代码可维护性。

This commit is contained in:
zyh
2025-04-10 07:03:49 +00:00
parent 777bfe70ed
commit de4a711318
3 changed files with 30 additions and 9 deletions

View File

@@ -131,10 +131,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
};
}, [token]);
const handleLogin = async (username: string, password: string): Promise<void> => {
const handleLogin = async (username: string, password: string, latitude?: number, longitude?: number): Promise<void> => {
try {
// 使用AuthAPI登录
const response = await AuthAPI.login(username, password);
const response = await AuthAPI.login(username, password, latitude, longitude);
// 保存token和用户信息
const { token: newToken, user: newUser } = response;