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

This commit is contained in:
zyh
2025-04-10 06:55:47 +00:00
parent c4905113d7
commit 52c4e2d187
5 changed files with 44 additions and 10 deletions

View File

@@ -63,9 +63,9 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
// 登录函数
const login = async (username: string, password: string) => {
const login = async (username: string, password: string, latitude?: number, longitude?: number) => {
try {
const response = await AuthAPI.login(username, password);
const response = await AuthAPI.login(username, password, latitude, longitude);
const { token, user } = response;
// 保存到状态和本地存储