fix: use absolute path in gql client (#5454) (#5462)

This commit is contained in:
DarkSky
2023-12-29 16:02:29 +08:00
committed by GitHub
parent de951c8779
commit 9e94e7195b
3 changed files with 15 additions and 11 deletions
+12 -1
View File
@@ -2,4 +2,15 @@ export * from './fetcher';
export * from './graphql';
export * from './schema';
export * from './utils';
import '@affine/env/global';
import { setupGlobal } from '@affine/env/global';
setupGlobal();
export function getBaseUrl(): string {
if (environment.isDesktop) {
return runtimeConfig.serverUrlPrefix;
}
const { protocol, hostname, port } = window.location;
return `${protocol}//${hostname}${port ? `:${port}` : ''}`;
}