mirror of
https://github.com/certd/certd.git
synced 2026-04-05 07:20:56 +08:00
fix: 修复企业管理模式下,切换用户登录后,丢失项目列表的bug
This commit is contained in:
@@ -15,11 +15,18 @@ export type ProjectItem = {
|
||||
export const useProjectStore = defineStore("app.project", () => {
|
||||
const myProjects = ref([]);
|
||||
const inited = ref(false);
|
||||
const currentProjectId = ref(); // 直接调用
|
||||
|
||||
function $reset() {
|
||||
myProjects.value = [];
|
||||
currentProjectId.value = "";
|
||||
inited.value = false;
|
||||
}
|
||||
const userStore = useUserStore();
|
||||
const userId = userStore.getUserInfo?.id;
|
||||
const lastProjectIdCacheKey = "currentProjectId:" + userId;
|
||||
const lastProjectId = LocalStorage.get(lastProjectIdCacheKey);
|
||||
const currentProjectId = ref(lastProjectId); // 直接调用
|
||||
currentProjectId.value = lastProjectId;
|
||||
|
||||
const projects = computed(() => {
|
||||
return myProjects.value;
|
||||
@@ -118,11 +125,6 @@ export const useProjectStore = defineStore("app.project", () => {
|
||||
return false;
|
||||
}
|
||||
|
||||
function $reset() {
|
||||
myProjects.value = [];
|
||||
currentProjectId.value = "";
|
||||
}
|
||||
|
||||
return {
|
||||
projects,
|
||||
myProjects,
|
||||
|
||||
Reference in New Issue
Block a user