diff --git a/cvat-core/package.json b/cvat-core/package.json index bfaf1b0d..8683d123 100644 --- a/cvat-core/package.json +++ b/cvat-core/package.json @@ -1,6 +1,6 @@ { "name": "cvat-core", - "version": "7.0.1", + "version": "7.0.2", "description": "Part of Computer Vision Tool which presents an interface for client-side integration", "main": "src/api.ts", "scripts": { diff --git a/cvat-core/src/api-implementation.ts b/cvat-core/src/api-implementation.ts index 22ea2ae1..5f6dd839 100644 --- a/cvat-core/src/api-implementation.ts +++ b/cvat-core/src/api-implementation.ts @@ -3,7 +3,7 @@ // // SPDX-License-Identifier: MIT -const config = require('./config'); +const config = require('./config').default; (() => { const PluginRegistry = require('./plugins').default; diff --git a/cvat-core/src/api.ts b/cvat-core/src/api.ts index 2225d95b..b9d58d3f 100644 --- a/cvat-core/src/api.ts +++ b/cvat-core/src/api.ts @@ -34,7 +34,7 @@ function build() { const User = require('./user').default; const pjson = require('../package.json'); - const config = require('./config'); + const config = require('./config').default; /** * API entrypoint diff --git a/cvat-core/src/server-proxy.ts b/cvat-core/src/server-proxy.ts index d2e337af..037c26ab 100644 --- a/cvat-core/src/server-proxy.ts +++ b/cvat-core/src/server-proxy.ts @@ -3,9 +3,16 @@ // // SPDX-License-Identifier: MIT -import { isEmail } from './common'; -import { StorageLocation, WebhookSourceType } from './enums'; +import FormData from 'form-data'; +import store from 'store'; +import Axios from 'axios'; +import * as tus from 'tus-js-client'; import { Storage } from './storage'; +import { StorageLocation, WebhookSourceType } from './enums'; +import { isEmail } from './common'; +import config from './config'; +import DownloadWorker from './download.worker'; +import { ServerError } from './exceptions'; type Params = { org: number | string, @@ -17,14 +24,6 @@ type Params = { action?: string, }; -const FormData = require('form-data'); -const store = require('store'); -const Axios = require('axios'); -const tus = require('tus-js-client'); -const config = require('./config'); -const DownloadWorker = require('./download.worker'); -const { ServerError } = require('./exceptions'); - function enableOrganization() { return { org: config.organizationID || '' }; } @@ -302,7 +301,6 @@ class ServerProxy { return []; } catch (errorData) { - throw generateError(errorData); } } @@ -426,6 +424,21 @@ class ServerProxy { } } + async function getSelf() { + const { backendAPI } = config; + + let response = null; + try { + response = await Axios.get(`${backendAPI}/users/self`, { + proxy: config.proxy, + }); + } catch (errorData) { + throw generateError(errorData); + } + + return response.data; + } + async function authorized() { try { await getSelf(); @@ -742,7 +755,7 @@ class ServerProxy { } } try { - return wait(); + return await wait(); } catch (errorData) { throw generateError(errorData); } @@ -1272,21 +1285,6 @@ class ServerProxy { return response.data.results; } - async function getSelf() { - const { backendAPI } = config; - - let response = null; - try { - response = await Axios.get(`${backendAPI}/users/self`, { - proxy: config.proxy, - }); - } catch (errorData) { - throw generateError(errorData); - } - - return response.data; - } - async function getPreview(tid, jid) { const { backendAPI } = config; @@ -1517,7 +1515,7 @@ class ServerProxy { } try { - return wait(); + return await wait(); } catch (errorData) { throw generateError(errorData); }