refactor: ♻️ 用户API和类型导入合并
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import AuthAPI from "@/api/auth";
|
||||
import UserAPI from "@/api/user";
|
||||
import AuthAPI, { LoginData } from "@/api/auth";
|
||||
import UserAPI, { UserInfo } from "@/api/user";
|
||||
import { resetRouter } from "@/router";
|
||||
import { store } from "@/store";
|
||||
|
||||
import { LoginData } from "@/api/auth";
|
||||
import { UserInfo } from "@/api/user";
|
||||
import { TOKEN_KEY } from "@/enums/CacheEnum";
|
||||
|
||||
export const useUserStore = defineStore("user", () => {
|
||||
@@ -89,7 +87,11 @@ export const useUserStore = defineStore("user", () => {
|
||||
};
|
||||
});
|
||||
|
||||
// 非setup
|
||||
/**
|
||||
* 用于在组件外部(如在Pinia Store 中)使用 Pinia 提供的 store 实例。
|
||||
* 官方文档解释了如何在组件外部使用 Pinia Store:
|
||||
* https://pinia.vuejs.org/core-concepts/outside-component-usage.html#using-a-store-outside-of-a-component
|
||||
*/
|
||||
export function useUserStoreHook() {
|
||||
return useUserStore(store);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user