mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
fix: rename leftover firebaseAuthStore/firebaseAuthActions local variables
Address review feedback: rename all local variable bindings from firebaseAuthStore → authStore and firebaseAuthActions → authActions to match the renamed store/composable exports. Also add explicit vi import to authStoreMock.ts for robustness. https://github.com/Comfy-Org/ComfyUI_frontend/pull/10483#discussion_r2990335291
This commit is contained in:
@@ -95,7 +95,7 @@ import { useAuthStore } from '@/stores/authStore'
|
||||
import { cn } from '@/utils/tailwindUtil'
|
||||
|
||||
const authStore = useAuthStore()
|
||||
const firebaseAuthActions = useAuthActions()
|
||||
const authActions = useAuthActions()
|
||||
const loading = computed(() => authStore.loading)
|
||||
const toast = useToast()
|
||||
|
||||
@@ -127,6 +127,6 @@ const handleForgotPassword = async (
|
||||
document.getElementById(emailInputId)?.focus?.()
|
||||
return
|
||||
}
|
||||
await firebaseAuthActions.sendPasswordReset(email)
|
||||
await authActions.sendPasswordReset(email)
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -33,7 +33,7 @@ export function useLegacyBilling(): BillingState & BillingActions {
|
||||
showSubscriptionDialog: legacyShowSubscriptionDialog
|
||||
} = useSubscription()
|
||||
|
||||
const firebaseAuthStore = useAuthStore()
|
||||
const authStore = useAuthStore()
|
||||
|
||||
const isInitialized = ref(false)
|
||||
const isLoading = ref(false)
|
||||
@@ -55,12 +55,12 @@ export function useLegacyBilling(): BillingState & BillingActions {
|
||||
renewalDate: formattedRenewalDate.value || null,
|
||||
endDate: formattedEndDate.value || null,
|
||||
isCancelled: isCancelled.value,
|
||||
hasFunds: (firebaseAuthStore.balance?.amount_micros ?? 0) > 0
|
||||
hasFunds: (authStore.balance?.amount_micros ?? 0) > 0
|
||||
}
|
||||
})
|
||||
|
||||
const balance = computed<BalanceInfo | null>(() => {
|
||||
const legacyBalance = firebaseAuthStore.balance
|
||||
const legacyBalance = authStore.balance
|
||||
if (!legacyBalance) return null
|
||||
|
||||
return {
|
||||
@@ -118,7 +118,7 @@ export function useLegacyBilling(): BillingState & BillingActions {
|
||||
isLoading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
await firebaseAuthStore.fetchBalance()
|
||||
await authStore.fetchBalance()
|
||||
} catch (err) {
|
||||
error.value =
|
||||
err instanceof Error ? err.message : 'Failed to fetch balance'
|
||||
|
||||
@@ -78,7 +78,7 @@ export function useCoreCommands(): ComfyCommand[] {
|
||||
const settingsDialog = useSettingsDialog()
|
||||
const dialogService = useDialogService()
|
||||
const colorPaletteStore = useColorPaletteStore()
|
||||
const firebaseAuthActions = useAuthActions()
|
||||
const authActions = useAuthActions()
|
||||
const toastStore = useToastStore()
|
||||
const canvasStore = useCanvasStore()
|
||||
const executionStore = useExecutionStore()
|
||||
@@ -996,7 +996,7 @@ export function useCoreCommands(): ComfyCommand[] {
|
||||
label: 'Sign Out',
|
||||
versionAdded: '1.18.1',
|
||||
function: async () => {
|
||||
await firebaseAuthActions.logout()
|
||||
await authActions.logout()
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -37,8 +37,8 @@ function useSubscriptionInternal() {
|
||||
const { reportError, accessBillingPortal } = useAuthActions()
|
||||
const { showSubscriptionRequiredDialog } = useDialogService()
|
||||
|
||||
const firebaseAuthStore = useAuthStore()
|
||||
const { getAuthHeader } = firebaseAuthStore
|
||||
const authStore = useAuthStore()
|
||||
const { getAuthHeader } = authStore
|
||||
const { wrapWithErrorHandlingAsync } = useErrorHandling()
|
||||
|
||||
const { isLoggedIn } = useCurrentUser()
|
||||
|
||||
@@ -48,10 +48,10 @@ export async function performSubscriptionCheckout(
|
||||
): Promise<void> {
|
||||
if (!isCloud) return
|
||||
|
||||
const firebaseAuthStore = useAuthStore()
|
||||
const { userId } = storeToRefs(firebaseAuthStore)
|
||||
const authStore = useAuthStore()
|
||||
const { userId } = storeToRefs(authStore)
|
||||
const telemetry = useTelemetry()
|
||||
const authHeader = await firebaseAuthStore.getAuthHeader()
|
||||
const authHeader = await authStore.getAuthHeader()
|
||||
|
||||
if (!authHeader) {
|
||||
throw new AuthStoreError(t('toastMessages.userNotAuthenticated'))
|
||||
|
||||
@@ -17,7 +17,7 @@ export class ImpactTelemetryProvider implements TelemetryProvider {
|
||||
private initialized = false
|
||||
private stores: {
|
||||
apiKeyAuthStore: ReturnType<typeof useApiKeyAuthStore>
|
||||
firebaseAuthStore: ReturnType<typeof useAuthStore>
|
||||
authStore: ReturnType<typeof useAuthStore>
|
||||
} | null = null
|
||||
|
||||
constructor() {
|
||||
@@ -109,12 +109,11 @@ export class ImpactTelemetryProvider implements TelemetryProvider {
|
||||
}
|
||||
}
|
||||
|
||||
if (stores.firebaseAuthStore.currentUser) {
|
||||
if (stores.authStore.currentUser) {
|
||||
return {
|
||||
customerId:
|
||||
stores.firebaseAuthStore.currentUser.uid ?? EMPTY_CUSTOMER_VALUE,
|
||||
customerId: stores.authStore.currentUser.uid ?? EMPTY_CUSTOMER_VALUE,
|
||||
customerEmail:
|
||||
stores.firebaseAuthStore.currentUser.email ?? EMPTY_CUSTOMER_VALUE
|
||||
stores.authStore.currentUser.email ?? EMPTY_CUSTOMER_VALUE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +134,7 @@ export class ImpactTelemetryProvider implements TelemetryProvider {
|
||||
|
||||
private resolveAuthStores(): {
|
||||
apiKeyAuthStore: ReturnType<typeof useApiKeyAuthStore>
|
||||
firebaseAuthStore: ReturnType<typeof useAuthStore>
|
||||
authStore: ReturnType<typeof useAuthStore>
|
||||
} | null {
|
||||
if (this.stores) {
|
||||
return this.stores
|
||||
@@ -144,7 +143,7 @@ export class ImpactTelemetryProvider implements TelemetryProvider {
|
||||
try {
|
||||
const stores = {
|
||||
apiKeyAuthStore: useApiKeyAuthStore(),
|
||||
firebaseAuthStore: useAuthStore()
|
||||
authStore: useAuthStore()
|
||||
}
|
||||
this.stores = stores
|
||||
return stores
|
||||
|
||||
@@ -181,8 +181,8 @@ export const useWorkspaceAuthStore = defineStore('workspaceAuth', () => {
|
||||
error.value = null
|
||||
|
||||
try {
|
||||
const firebaseAuthStore = useAuthStore()
|
||||
const firebaseToken = await firebaseAuthStore.getIdToken()
|
||||
const authStore = useAuthStore()
|
||||
const firebaseToken = await authStore.getIdToken()
|
||||
if (!firebaseToken) {
|
||||
throw new WorkspaceAuthError(
|
||||
t('workspaceAuth.errors.notAuthenticated'),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { vi } from 'vitest'
|
||||
import type { Mock } from 'vitest'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ type ComfyApiUser =
|
||||
const STORAGE_KEY = 'comfy_api_key'
|
||||
|
||||
export const useApiKeyAuthStore = defineStore('apiKeyAuth', () => {
|
||||
const firebaseAuthStore = useAuthStore()
|
||||
const authStore = useAuthStore()
|
||||
const apiKey = useLocalStorage<string | null>(STORAGE_KEY, null)
|
||||
const toastStore = useToastStore()
|
||||
const { wrapWithErrorHandlingAsync, toastErrorHandler } = useErrorHandling()
|
||||
@@ -24,7 +24,7 @@ export const useApiKeyAuthStore = defineStore('apiKeyAuth', () => {
|
||||
const isAuthenticated = computed(() => !!currentUser.value)
|
||||
|
||||
const initializeUserFromApiKey = async () => {
|
||||
const createCustomerResponse = await firebaseAuthStore
|
||||
const createCustomerResponse = await authStore
|
||||
.createCustomer()
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
|
||||
@@ -120,7 +120,7 @@ watch(linearMode, (isLinear) => {
|
||||
})
|
||||
|
||||
const telemetry = useTelemetry()
|
||||
const firebaseAuthStore = useAuthStore()
|
||||
const authStore = useAuthStore()
|
||||
let hasTrackedLogin = false
|
||||
|
||||
watch(
|
||||
@@ -308,7 +308,7 @@ void nextTick(() => {
|
||||
const onGraphReady = () => {
|
||||
runWhenGlobalIdle(() => {
|
||||
// Track user login when app is ready in graph view (cloud only)
|
||||
if (isCloud && firebaseAuthStore.isAuthenticated && !hasTrackedLogin) {
|
||||
if (isCloud && authStore.isAuthenticated && !hasTrackedLogin) {
|
||||
telemetry?.trackUserLoggedIn()
|
||||
hasTrackedLogin = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user