Skip to content

Commit 9b6921a

Browse files
authored
fix!: settings endpoint usage (#3258)
1 parent 002e75d commit 9b6921a

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

src/services/api/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {AxiosWrapperOptions} from '@gravity-ui/axios-wrapper';
22
import type {AxiosRequestConfig} from 'axios';
33

44
import {codeAssistBackend} from '../../store';
5-
import {uiFactory} from '../../uiFactory/uiFactory';
65

76
import {AuthAPI} from './auth';
87
import {CodeAssistAPI} from './codeAssist';
@@ -47,7 +46,6 @@ export class YdbEmbeddedAPI {
4746
metaSettings?: MetaSettingsAPI;
4847
codeAssist?: CodeAssistAPI;
4948

50-
// eslint-disable-next-line complexity
5149
constructor({
5250
webVersion = false,
5351
withCredentials = false,
@@ -60,18 +58,13 @@ export class YdbEmbeddedAPI {
6058
}: YdbEmbeddedAPIProps) {
6159
const axiosParams: AxiosWrapperOptions = {config: {withCredentials, ...defaults}};
6260
const baseApiParams = {singleClusterMode, proxyMeta, useRelativePath};
63-
const settingsUserId = uiFactory.settingsBackend?.getUserId?.();
64-
const metaSettingsBaseUrl = uiFactory.settingsBackend?.getEndpoint?.();
6561

6662
this.auth = new AuthAPI(axiosParams, baseApiParams);
6763
if (webVersion) {
6864
this.meta = new MetaAPI(axiosParams, baseApiParams);
6965
}
7066
if (useMetaSettings) {
7167
this.metaSettings = new MetaSettingsAPI(axiosParams, baseApiParams);
72-
if (metaSettingsBaseUrl && settingsUserId) {
73-
this.metaSettings.setBaseUrlOverride(metaSettingsBaseUrl);
74-
}
7568
}
7669

7770
if (webVersion || codeAssistBackend) {

src/services/api/metaSettings.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
SetSingleSettingParams,
77
SettingValue,
88
} from '../../types/api/settings';
9+
import {uiFactory} from '../../uiFactory/uiFactory';
910

1011
import {BaseMetaAPI} from './baseMeta';
1112

@@ -24,16 +25,14 @@ export class MetaSettingsAPI extends BaseMetaAPI {
2425
private batchTimeout: NodeJS.Timeout | undefined = undefined;
2526
private currentUser: string | undefined = undefined;
2627
private requestQueue: Map<string, PendingRequest[]> | undefined = undefined;
27-
private baseUrlOverride: string | undefined;
28-
29-
setBaseUrlOverride(baseUrlOverride: string | undefined) {
30-
this.baseUrlOverride = baseUrlOverride;
31-
}
3228

3329
getPath(path: string, clusterName?: string) {
34-
if (this.baseUrlOverride) {
35-
return joinBaseUrlAndPath(this.baseUrlOverride, path);
30+
const settingsUserId = uiFactory.settingsBackend?.getUserId?.();
31+
const metaSettingsBaseUrl = uiFactory.settingsBackend?.getEndpoint?.();
32+
if (metaSettingsBaseUrl && settingsUserId) {
33+
return joinBaseUrlAndPath(metaSettingsBaseUrl, path);
3634
}
35+
3736
return super.getPath(path, clusterName);
3837
}
3938

0 commit comments

Comments
 (0)