|
| 1 | +import type {AxiosWrapperOptions} from '@gravity-ui/axios-wrapper'; |
1 | 2 | import type {AxiosRequestConfig} from 'axios'; |
2 | 3 |
|
3 | 4 | import {codeAssistBackend} from '../../store'; |
@@ -30,33 +31,36 @@ export class YdbEmbeddedAPI { |
30 | 31 | constructor({ |
31 | 32 | webVersion = false, |
32 | 33 | withCredentials = false, |
| 34 | + singleClusterMode, |
33 | 35 | csrfTokenGetter = () => undefined, |
34 | 36 | defaults = {}, |
35 | 37 | }: { |
36 | 38 | webVersion?: boolean; |
37 | 39 | withCredentials?: boolean; |
| 40 | + singleClusterMode?: boolean; |
38 | 41 | csrfTokenGetter?: () => string | undefined; |
39 | 42 | defaults?: AxiosRequestConfig; |
40 | 43 | } = {}) { |
41 | | - const config: AxiosRequestConfig = {withCredentials, ...defaults}; |
| 44 | + const axiosParams: AxiosWrapperOptions = {config: {withCredentials, ...defaults}}; |
| 45 | + const baseApiParams = {singleClusterMode}; |
42 | 46 |
|
43 | | - this.auth = new AuthAPI({config}); |
| 47 | + this.auth = new AuthAPI(axiosParams, baseApiParams); |
44 | 48 | if (webVersion) { |
45 | | - this.meta = new MetaAPI({config}); |
| 49 | + this.meta = new MetaAPI(axiosParams, baseApiParams); |
46 | 50 | } |
47 | 51 |
|
48 | 52 | if (webVersion || codeAssistBackend) { |
49 | | - this.codeAssist = new CodeAssistAPI({config}); |
| 53 | + this.codeAssist = new CodeAssistAPI(axiosParams, baseApiParams); |
50 | 54 | } |
51 | 55 |
|
52 | | - this.operation = new OperationAPI({config}); |
53 | | - this.pdisk = new PDiskAPI({config}); |
54 | | - this.scheme = new SchemeAPI({config}); |
55 | | - this.storage = new StorageAPI({config}); |
56 | | - this.streaming = new StreamingAPI({config}); |
57 | | - this.tablets = new TabletsAPI({config}); |
58 | | - this.vdisk = new VDiskAPI({config}); |
59 | | - this.viewer = new ViewerAPI({config}); |
| 56 | + this.operation = new OperationAPI(axiosParams, baseApiParams); |
| 57 | + this.pdisk = new PDiskAPI(axiosParams, baseApiParams); |
| 58 | + this.scheme = new SchemeAPI(axiosParams, baseApiParams); |
| 59 | + this.storage = new StorageAPI(axiosParams, baseApiParams); |
| 60 | + this.streaming = new StreamingAPI(axiosParams, baseApiParams); |
| 61 | + this.tablets = new TabletsAPI(axiosParams, baseApiParams); |
| 62 | + this.vdisk = new VDiskAPI(axiosParams, baseApiParams); |
| 63 | + this.viewer = new ViewerAPI(axiosParams, baseApiParams); |
60 | 64 |
|
61 | 65 | const token = csrfTokenGetter(); |
62 | 66 | if (token) { |
|
0 commit comments