- client: fix api client export

This commit is contained in:
Ildar Kamalov 2019-09-05 12:12:58 +03:00 committed by Simon Zolin
parent 0e6c795c5b
commit 8c89973365
12 changed files with 15 additions and 31 deletions

View file

@ -1,10 +1,8 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
import { normalizeTextarea } from '../helpers/helpers'; import { normalizeTextarea } from '../helpers/helpers';
const apiClient = new Api();
export const getAccessListRequest = createAction('GET_ACCESS_LIST_REQUEST'); export const getAccessListRequest = createAction('GET_ACCESS_LIST_REQUEST');
export const getAccessListFailure = createAction('GET_ACCESS_LIST_FAILURE'); export const getAccessListFailure = createAction('GET_ACCESS_LIST_FAILURE');
export const getAccessListSuccess = createAction('GET_ACCESS_LIST_SUCCESS'); export const getAccessListSuccess = createAction('GET_ACCESS_LIST_SUCCESS');

View file

@ -1,11 +1,9 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import { t } from 'i18next'; import { t } from 'i18next';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast, getClients } from './index'; import { addErrorToast, addSuccessToast, getClients } from './index';
import { CLIENT_ID } from '../helpers/constants'; import { CLIENT_ID } from '../helpers/constants';
const apiClient = new Api();
export const toggleClientModal = createAction('TOGGLE_CLIENT_MODAL'); export const toggleClientModal = createAction('TOGGLE_CLIENT_MODAL');
export const addClientRequest = createAction('ADD_CLIENT_REQUEST'); export const addClientRequest = createAction('ADD_CLIENT_REQUEST');

View file

@ -1,10 +1,8 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
import { redirectToCurrentProtocol } from '../helpers/helpers'; import { redirectToCurrentProtocol } from '../helpers/helpers';
const apiClient = new Api();
export const getTlsStatusRequest = createAction('GET_TLS_STATUS_REQUEST'); export const getTlsStatusRequest = createAction('GET_TLS_STATUS_REQUEST');
export const getTlsStatusFailure = createAction('GET_TLS_STATUS_FAILURE'); export const getTlsStatusFailure = createAction('GET_TLS_STATUS_FAILURE');
export const getTlsStatusSuccess = createAction('GET_TLS_STATUS_SUCCESS'); export const getTlsStatusSuccess = createAction('GET_TLS_STATUS_SUCCESS');

View file

@ -7,9 +7,7 @@ import versionCompare from '../helpers/versionCompare';
import { normalizeFilteringStatus, normalizeTextarea, sortClients } from '../helpers/helpers'; import { normalizeFilteringStatus, normalizeTextarea, sortClients } from '../helpers/helpers';
import { SETTINGS_NAMES, CHECK_TIMEOUT } from '../helpers/constants'; import { SETTINGS_NAMES, CHECK_TIMEOUT } from '../helpers/constants';
import { getTlsStatus } from './encryption'; import { getTlsStatus } from './encryption';
import Api from '../api/Api'; import apiClient from '../api/Api';
const apiClient = new Api();
export const addErrorToast = createAction('ADD_ERROR_TOAST'); export const addErrorToast = createAction('ADD_ERROR_TOAST');
export const addSuccessToast = createAction('ADD_SUCCESS_TOAST'); export const addSuccessToast = createAction('ADD_SUCCESS_TOAST');

View file

@ -1,9 +1,7 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
const apiClient = new Api();
export const nextStep = createAction('NEXT_STEP'); export const nextStep = createAction('NEXT_STEP');
export const prevStep = createAction('PREV_STEP'); export const prevStep = createAction('PREV_STEP');

View file

@ -1,11 +1,9 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
import { normalizeLogs } from '../helpers/helpers'; import { normalizeLogs } from '../helpers/helpers';
const apiClient = new Api();
export const getLogsRequest = createAction('GET_LOGS_REQUEST'); export const getLogsRequest = createAction('GET_LOGS_REQUEST');
export const getLogsFailure = createAction('GET_LOGS_FAILURE'); export const getLogsFailure = createAction('GET_LOGS_FAILURE');
export const getLogsSuccess = createAction('GET_LOGS_SUCCESS'); export const getLogsSuccess = createAction('GET_LOGS_SUCCESS');

View file

@ -1,10 +1,8 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import { t } from 'i18next'; import { t } from 'i18next';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
const apiClient = new Api();
export const toggleRewritesModal = createAction('TOGGLE_REWRITES_MODAL'); export const toggleRewritesModal = createAction('TOGGLE_REWRITES_MODAL');
export const getRewritesListRequest = createAction('GET_REWRITES_LIST_REQUEST'); export const getRewritesListRequest = createAction('GET_REWRITES_LIST_REQUEST');

View file

@ -1,9 +1,7 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
const apiClient = new Api();
export const getBlockedServicesRequest = createAction('GET_BLOCKED_SERVICES_REQUEST'); export const getBlockedServicesRequest = createAction('GET_BLOCKED_SERVICES_REQUEST');
export const getBlockedServicesFailure = createAction('GET_BLOCKED_SERVICES_FAILURE'); export const getBlockedServicesFailure = createAction('GET_BLOCKED_SERVICES_FAILURE');
export const getBlockedServicesSuccess = createAction('GET_BLOCKED_SERVICES_SUCCESS'); export const getBlockedServicesSuccess = createAction('GET_BLOCKED_SERVICES_SUCCESS');

View file

@ -1,11 +1,9 @@
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import Api from '../api/Api'; import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index'; import { addErrorToast, addSuccessToast } from './index';
import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers'; import { normalizeTopStats, secondsToMilliseconds } from '../helpers/helpers';
const apiClient = new Api();
export const getStatsConfigRequest = createAction('GET_STATS_CONFIG_REQUEST'); export const getStatsConfigRequest = createAction('GET_STATS_CONFIG_REQUEST');
export const getStatsConfigFailure = createAction('GET_STATS_CONFIG_FAILURE'); export const getStatsConfigFailure = createAction('GET_STATS_CONFIG_FAILURE');
export const getStatsConfigSuccess = createAction('GET_STATS_CONFIG_SUCCESS'); export const getStatsConfigSuccess = createAction('GET_STATS_CONFIG_SUCCESS');

View file

@ -1,6 +1,6 @@
import axios from 'axios'; import axios from 'axios';
export default class Api { class Api {
baseUrl = 'control'; baseUrl = 'control';
async makeRequest(path, method = 'POST', config) { async makeRequest(path, method = 'POST', config) {
@ -528,3 +528,6 @@ export default class Api {
return this.makeRequest(path, method); return this.makeRequest(path, method);
} }
} }
const apiClient = new Api();
export default apiClient;

View file

@ -371,7 +371,7 @@ class Logs extends Component {
<Loading /> <Loading />
)} )}
{enabled && isDataReady && this.renderLogs(queryLogs.logs)} {enabled && isDataReady && this.renderLogs(queryLogs.logs)}
{!enabled && isDataReady && ( {!enabled && !processingGetConfig && (
<div className="lead text-center py-6"> <div className="lead text-center py-6">
<Trans components={[<Link to="/settings#logs-config" key="0">link</Link>]}> <Trans components={[<Link to="/settings#logs-config" key="0">link</Link>]}>
query_log_disabled query_log_disabled

View file

@ -2,7 +2,7 @@ import { connect } from 'react-redux';
import { initSettings, toggleSetting } from '../actions'; import { initSettings, toggleSetting } from '../actions';
import { getBlockedServices, setBlockedServices } from '../actions/services'; import { getBlockedServices, setBlockedServices } from '../actions/services';
import { getStatsConfig, setStatsConfig, resetStats } from '../actions/stats'; import { getStatsConfig, setStatsConfig, resetStats } from '../actions/stats';
import { toggleLogStatus, clearLogs, getLogsConfig, setLogsConfig } from '../actions/queryLogs'; import { clearLogs, getLogsConfig, setLogsConfig } from '../actions/queryLogs';
import Settings from '../components/Settings'; import Settings from '../components/Settings';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
@ -26,7 +26,6 @@ const mapDispatchToProps = {
getStatsConfig, getStatsConfig,
setStatsConfig, setStatsConfig,
resetStats, resetStats,
toggleLogStatus,
clearLogs, clearLogs,
getLogsConfig, getLogsConfig,
setLogsConfig, setLogsConfig,