expose user loggedin in extensionManager (#3871)

This commit is contained in:
杨必赞
2025-05-14 09:04:27 +08:00
committed by GitHub
parent b152f67d95
commit 7c5c47c105

View File

@@ -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,