From 7c5c47c105c3b35b06a87076ccd270d559bd28f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=85=E8=B5=9E?= <348063288@qq.com> Date: Wed, 14 May 2025 09:04:27 +0800 Subject: [PATCH] expose user loggedin in extensionManager (#3871) --- src/stores/workspaceStore.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/stores/workspaceStore.ts b/src/stores/workspaceStore.ts index 33086ef65f..3568aae8c2 100644 --- a/src/stores/workspaceStore.ts +++ b/src/stores/workspaceStore.ts @@ -6,7 +6,9 @@ import { useColorPaletteService } from '@/services/colorPaletteService' import { useDialogService } from '@/services/dialogService' import type { SidebarTabExtension, ToastManager } from '@/types/extensionTypes' +import { useApiKeyAuthStore } from './apiKeyAuthStore' import { useCommandStore } from './commandStore' +import { useFirebaseAuthStore } from './firebaseAuthStore' import { useQueueSettingsStore } from './queueStore' import { useSettingStore } from './settingStore' import { useToastStore } from './toastStore' @@ -43,6 +45,18 @@ export const useWorkspaceStore = defineStore('workspace', () => { const dialog = useDialogService() const bottomPanel = useBottomPanelStore() + const authStore = useFirebaseAuthStore() + const apiKeyStore = useApiKeyAuthStore() + + const firebaseUser = computed(() => authStore.currentUser) + const isApiKeyLogin = computed(() => apiKeyStore.isAuthenticated) + const isLoggedIn = computed( + () => !!isApiKeyLogin.value || firebaseUser.value !== null + ) + const partialUserStore = { + isLoggedIn + } + /** * Registers a sidebar tab. * @param tab The sidebar tab to register. @@ -86,6 +100,7 @@ export const useWorkspaceStore = defineStore('workspace', () => { colorPalette, dialog, bottomPanel, + user: partialUserStore, registerSidebarTab, unregisterSidebarTab,