1
This commit is contained in:
@@ -16,7 +16,7 @@ interface GlobalState {
|
||||
interface GlobalActions {
|
||||
updateState: (payload: Record<string, any>) => void;
|
||||
getNavbarHeightInfo: () => void;
|
||||
getCurrentLocationInfo: () => void;
|
||||
getCurrentLocationInfo: () => any;
|
||||
}
|
||||
// 完整的 Store 类型
|
||||
type GlobalStore = GlobalState & GlobalActions;
|
||||
@@ -50,14 +50,13 @@ export const useGlobalStore = create<GlobalStore>()((set, get) => ({
|
||||
},
|
||||
|
||||
// 获取位置信息
|
||||
getCurrentLocationInfo: () => {
|
||||
return getCurrentLocation().then((res) => {
|
||||
set({
|
||||
getLocationLoading: false,
|
||||
location: res || {},
|
||||
});
|
||||
return res;
|
||||
getCurrentLocationInfo: async () => {
|
||||
const res = await getCurrentLocation()
|
||||
set({
|
||||
getLocationLoading: false,
|
||||
location: res || {},
|
||||
});
|
||||
return res;
|
||||
},
|
||||
|
||||
// 更新store数据
|
||||
|
||||
Reference in New Issue
Block a user