refactor: migrate environment to BUILD_CONFIG (#8206)

This commit is contained in:
forehalo
2024-09-13 07:58:20 +00:00
parent 561f96bb71
commit a387e4ac07
90 changed files with 297 additions and 260 deletions

View File

@@ -91,7 +91,7 @@ export class AuthService extends Service {
email,
// we call it [callbackUrl] instead of [redirect_uri]
// to make it clear the url is used to finish the sign-in process instead of redirect after signed-in
callbackUrl: `/magic-link?client=${environment.isElectron ? appInfo?.schema : 'web'}`,
callbackUrl: `/magic-link?client=${BUILD_CONFIG.isElectron ? appInfo?.schema : 'web'}`,
}),
headers: {
'content-type': 'application/json',

View File

@@ -5,7 +5,7 @@ import { fromPromise, Service } from '@toeverything/infra';
import { BackendError, NetworkError } from '../error';
export function getAffineCloudBaseUrl(): string {
if (environment.isElectron) {
if (BUILD_CONFIG.isElectron) {
return BUILD_CONFIG.serverUrlPrefix;
}
const { protocol, hostname, port } = window.location;

View File

@@ -28,7 +28,7 @@ const getDefaultSubscriptionSuccessCallbackLink = (
plan === SubscriptionPlan.AI ? '/ai-upgrade-success' : '/upgrade-success';
const urlString = getAffineCloudBaseUrl() + path;
const url = new URL(urlString);
if (environment.isElectron && appInfo) {
if (BUILD_CONFIG.isElectron && appInfo) {
url.searchParams.set('schema', appInfo.schema);
}
return url.toString();