perf: getEnvironment() -> env (#2636)

This commit is contained in:
Simon He
2023-06-01 11:23:38 +08:00
committed by GitHub
parent e1314730be
commit fc9462eee9
16 changed files with 70 additions and 86 deletions

View File

@@ -1,5 +1,5 @@
import { DebugLogger } from '@affine/debug';
import { getEnvironment } from '@affine/env';
import { env } from '@affine/env';
import { assertExists } from '@blocksuite/global/utils';
import { Slot } from '@blocksuite/store';
import { initializeApp } from 'firebase/app';
@@ -165,7 +165,6 @@ export function createAffineAuth(prefix = '/') {
method: SignMethod
): Promise<LoginResponse | null> => {
const auth = getAuth();
const environment = getEnvironment();
if (!auth) {
throw new Error('Failed to initialize firebase');
}
@@ -189,7 +188,7 @@ export function createAffineAuth(prefix = '/') {
}
try {
let idToken: string | undefined;
if (environment.isDesktop) {
if (env.isDesktop) {
idToken = await signInWithElectron(auth);
} else {
const response = await signInWithPopup(auth, provider);