Skip to content

Commit 7c5c47c

Browse files
authored
expose user loggedin in extensionManager (#3871)
1 parent b152f67 commit 7c5c47c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/stores/workspaceStore.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import { useColorPaletteService } from '@/services/colorPaletteService'
66
import { useDialogService } from '@/services/dialogService'
77
import type { SidebarTabExtension, ToastManager } from '@/types/extensionTypes'
88

9+
import { useApiKeyAuthStore } from './apiKeyAuthStore'
910
import { useCommandStore } from './commandStore'
11+
import { useFirebaseAuthStore } from './firebaseAuthStore'
1012
import { useQueueSettingsStore } from './queueStore'
1113
import { useSettingStore } from './settingStore'
1214
import { useToastStore } from './toastStore'
@@ -43,6 +45,18 @@ export const useWorkspaceStore = defineStore('workspace', () => {
4345
const dialog = useDialogService()
4446
const bottomPanel = useBottomPanelStore()
4547

48+
const authStore = useFirebaseAuthStore()
49+
const apiKeyStore = useApiKeyAuthStore()
50+
51+
const firebaseUser = computed(() => authStore.currentUser)
52+
const isApiKeyLogin = computed(() => apiKeyStore.isAuthenticated)
53+
const isLoggedIn = computed(
54+
() => !!isApiKeyLogin.value || firebaseUser.value !== null
55+
)
56+
const partialUserStore = {
57+
isLoggedIn
58+
}
59+
4660
/**
4761
* Registers a sidebar tab.
4862
* @param tab The sidebar tab to register.
@@ -86,6 +100,7 @@ export const useWorkspaceStore = defineStore('workspace', () => {
86100
colorPalette,
87101
dialog,
88102
bottomPanel,
103+
user: partialUserStore,
89104

90105
registerSidebarTab,
91106
unregisterSidebarTab,

0 commit comments

Comments
 (0)