更新移动端认证API,新增地理位置参数支持,优化登录逻辑以处理位置获取失败的情况,提升用户体验和代码可维护性。
This commit is contained in:
@@ -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;
|
||||
|
||||
// 保存到状态和本地存储
|
||||
|
||||
Reference in New Issue
Block a user