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,