- 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 Api from '../api/Api';
import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index';
import { normalizeTextarea } from '../helpers/helpers';
const apiClient = new Api();
export const getAccessListRequest = createAction('GET_ACCESS_LIST_REQUEST');
export const getAccessListFailure = createAction('GET_ACCESS_LIST_FAILURE');
export const getAccessListSuccess = createAction('GET_ACCESS_LIST_SUCCESS');

View file

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

View file

@ -1,10 +1,8 @@
import { createAction } from 'redux-actions';
import Api from '../api/Api';
import apiClient from '../api/Api';
import { addErrorToast, addSuccessToast } from './index';
import { redirectToCurrentProtocol } from '../helpers/helpers';
const apiClient = new Api();
export const getTlsStatusRequest = createAction('GET_TLS_STATUS_REQUEST');
export const getTlsStatusFailure = createAction('GET_TLS_STATUS_FAILURE');
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 { SETTINGS_NAMES, CHECK_TIMEOUT } from '../helpers/constants';
import { getTlsStatus } from './encryption';
import Api from '../api/Api';
const apiClient = new Api();
import apiClient from '../api/Api';
export const addErrorToast = createAction('ADD_ERROR_TOAST');
export const addSuccessToast = createAction('ADD_SUCCESS_TOAST');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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