Web: Client: fix imports

This commit is contained in:
Artem Tarasov 2021-02-26 00:17:25 +03:00
parent c35d0612f0
commit 7af174ca65
14 changed files with 39 additions and 59 deletions

View File

@ -3,9 +3,8 @@ import { withRouter } from "react-router";
import PropTypes from "prop-types";
import Loader from "@appserver/components/loader";
import PageLayout from "@appserver/common/components/PageLayout";
import commonUtils from "@appserver/common/utils";
import { tryRedirectTo } from "@appserver/common/utils";
import { inject, observer } from "mobx-react";
const { tryRedirectTo } = commonUtils;
class ActivateEmail extends React.PureComponent {
componentDidMount() {

View File

@ -4,7 +4,11 @@ import { withTranslation } from "react-i18next";
import styled from "styled-components";
import PropTypes from "prop-types";
import axios from "axios";
import api from "@appserver/common/api";
import {
changePassword,
updateActivationStatus,
updateUser,
} from "@appserver/common/api/people";
import { inject, observer } from "mobx-react";
import Button from "@appserver/components/button";
import TextInput from "@appserver/components/text-input";
@ -14,9 +18,8 @@ import toastr from "@appserver/components/toast/toastr";
import Loader from "@appserver/components/loader";
import PageLayout from "@appserver/common/components/PageLayout";
import constants from "@appserver/common/constants";
import commonUtils from "@appserver/common/utils";
import { createPasswordHash } from "@appserver/common/utils";
const { EmployeeActivationStatus } = constants;
const { createPasswordHash } = commonUtils;
const inputWidth = "400px";
@ -155,19 +158,11 @@ class Confirm extends React.PureComponent {
LastName: personalData.lastname,
};
const res1 = await api.people.changePassword(
userId,
loginData.passwordHash,
key
);
const res1 = await changePassword(userId, loginData.passwordHash, key);
console.log("changePassword", res1);
const res2 = await api.people.updateActivationStatus(
activationStatus,
userId,
key
);
const res2 = await updateActivationStatus(activationStatus, userId, key);
console.log("updateActivationStatus", res2);
@ -178,7 +173,7 @@ class Confirm extends React.PureComponent {
console.log("Login", res3);
const res4 = await api.people.updateUser(changedData);
const res4 = await updateUser(changedData);
console.log("updateUser", res4);
};

View File

@ -4,9 +4,7 @@ import PropTypes from "prop-types";
import { inject, observer } from "mobx-react";
import Loader from "@appserver/components/loader";
import PageLayout from "@appserver/common/components/PageLayout";
import commonUtils from "@appserver/common/utils";
const { tryRedirectTo } = commonUtils;
import { tryRedirectTo } from "@appserver/common/utils";
class ChangeEmail extends React.PureComponent {
componentDidMount() {

View File

@ -6,9 +6,8 @@ import Button from "@appserver/components/button";
import Text from "@appserver/components/text";
import toastr from "@appserver/components/toast/toastr";
import PageLayout from "@appserver/common/components/PageLayout";
import commonUtils from "@appserver/common/utils";
import { tryRedirectTo } from "@appserver/common/utils";
import { inject, observer } from "mobx-react";
const { tryRedirectTo } = commonUtils;
const BodyStyle = styled.div`
margin-top: 70px;

View File

@ -12,13 +12,10 @@ import toastr from "@appserver/components/toast/toastr";
import Heading from "@appserver/components/heading";
import PageLayout from "@appserver/common/components/PageLayout";
import store from "@appserver/common/store";
import commonUtils from "@appserver/common/utils";
import { createPasswordHash, tryRedirectTo } from "@appserver/common/utils";
import { inject, observer } from "mobx-react";
const { createPasswordHash, tryRedirectTo } = commonUtils;
const BodyStyle = styled.form`
margin: 70px auto 0 auto;
max-width: 500px;

View File

@ -4,7 +4,7 @@ import { withTranslation } from "react-i18next";
import styled from "styled-components";
import PropTypes from "prop-types";
import axios from "axios";
import api from "@appserver/common/api";
import { createUser } from "@appserver/common/api/people";
import { inject, observer } from "mobx-react";
import Button from "@appserver/components/button";
import TextInput from "@appserver/components/text-input";
@ -14,9 +14,8 @@ import toastr from "@appserver/components/toast/toastr";
import Loader from "@appserver/components/loader";
import EmailInput from "@appserver/components/email-input";
import PageLayout from "@appserver/common/components/PageLayout";
import commonUtils from "@appserver/common/utils";
import { createPasswordHash } from "@appserver/common/utils";
const { createPasswordHash } = commonUtils;
const inputWidth = "400px";
const ConfirmContainer = styled.div`
@ -156,7 +155,7 @@ class Confirm extends React.PureComponent {
loginData
);
const user = await api.people.createUser(data, key);
const user = await createUser(data, key);
console.log("Created user", user);

View File

@ -8,12 +8,7 @@ import { inject, observer } from "mobx-react";
import Button from "@appserver/components/button";
import Text from "@appserver/components/text";
import PageLayout from "@appserver/common/components/PageLayout";
import store from "@appserver/common/store";
import api from "@appserver/common/api";
const { logout } = store.auth.actions;
const { deleteSelf } = api.people;
const { deleteSelf } = api.people; //TODO: Move inside UserStore
import { deleteSelf } from "@appserver/common/api/people"; //TODO: Move inside UserStore
const ProfileRemoveContainer = styled.div`
display: flex;

View File

@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
import Box from "@appserver/components/box";
import { useTranslation } from "react-i18next";
import { getObjectByLocation } from "@appserver/common/utils";
import ErrorContainer from "@appserver/common/components/ErrorContainer";

View File

@ -8,7 +8,7 @@ import axios from "axios";
import PageLayout from "@appserver/common/components/PageLayout";
import ErrorContainer from "@appserver/common/components/ErrorContainer";
import history from "@appserver/common/history";
import commonUtils from "@appserver/common/utils";
import { createPasswordHash } from "@appserver/common/utils";
import Loader from "@appserver/components/loader";
import { tablet } from "@appserver/components/utils/device";
import { EmailSettings } from "@appserver/components/utils/email";
@ -22,8 +22,6 @@ import ModalContainer from "./sub-components/modal-dialog-container";
import { setDocumentTitle } from "../../../helpers/utils";
import { inject, observer } from "mobx-react";
const { createPasswordHash } = commonUtils;
const emailSettings = new EmailSettings();
emailSettings.allowDomainPunycode = true;

View File

@ -4,12 +4,9 @@ import { ValidationResult } from "./../helpers/constants";
import { withRouter } from "react-router";
import Loader from "@appserver/components/loader";
import PageLayout from "@appserver/common/components/PageLayout";
import api from "@appserver/common/api";
import constants from "@appserver/common/constants";
import utils from "@appserver/common/utils";
import { checkConfirmLink } from "@appserver/common/api/user"; //TODO: Move AuthStore
import { getObjectByLocation } from "@appserver/common/utils";
import { inject, observer } from "mobx-react";
const { checkConfirmLink } = api.user; //TODO: Move AuthStore
const { getObjectByLocation } = utils;
class ConfirmRoute extends React.Component {
constructor(props) {

View File

@ -1,8 +1,6 @@
import commonStore from "@appserver/common/store";
import authStore from "@appserver/common/store/AuthStore";
//import store from "../store/store";
const { authStore } = commonStore;
//const { getCurrentProduct } = commonStore.auth.selectors;
export const setDocumentTitle = (subTitle = null) => {

View File

@ -3,7 +3,6 @@ import { initReactI18next } from "react-i18next";
import Backend from "i18next-http-backend";
import config from "../package.json";
import { LANGUAGE } from "@appserver/common/constants";
//const { LANGUAGE /*i18nBaseSettings*/ } = constants;
//import LanguageDetector from "i18next-browser-languagedetector";
// not like to use this?

View File

@ -1,4 +1,8 @@
import api from "@appserver/common/api";
import {
getPaymentSettings,
setLicense,
acceptLicense,
} from "@appserver/common/api/settings";
import { makeAutoObservable } from "mobx";
class PaymentStore {
@ -17,7 +21,7 @@ class PaymentStore {
}
getSettingsPayment = async () => {
const newSettings = await api.settings.getPaymentSettings();
const newSettings = await getPaymentSettings();
const {
buyUrl,
salesEmail,
@ -42,7 +46,7 @@ class PaymentStore {
};
setPaymentsLicense = async (confirmKey, data) => {
const response = await api.settings.setLicense(confirmKey, data);
const response = await setLicense(confirmKey, data);
this.acceptPaymentsLicense();
this.getSettingsPayment();
@ -51,9 +55,7 @@ class PaymentStore {
};
acceptPaymentsLicense = async () => {
const response = await api.settings
.acceptLicense()
.then((res) => console.log(res));
const response = await acceptLicense().then((res) => console.log(res));
return response;
};

View File

@ -1,4 +1,9 @@
import api from "@appserver/common/api";
import {
getMachineName,
setPortalOwner,
getIsLicenseRequired,
setLicense,
} from "@appserver/common/api/settings";
import { makeAutoObservable } from "mobx";
class WizardStore {
@ -32,7 +37,7 @@ class WizardStore {
};
getMachineName = async (token) => {
const machineName = await api.settings.getMachineName(token);
const machineName = await getMachineName(token);
this.machineName = machineName;
};
@ -44,7 +49,7 @@ class WizardStore {
confirmKey,
analytics
) => {
const response = await api.settings.setPortalOwner(
const response = await setPortalOwner(
email,
hash,
lng,
@ -59,13 +64,13 @@ class WizardStore {
};
getIsRequiredLicense = async () => {
const isRequired = await api.settings.getIsLicenseRequired();
const isRequired = await getIsLicenseRequired();
this.setIsRequiredLicense(isRequired);
};
setLicense = async (confirmKey, data) => {
const message = await api.settings.setLicense(confirmKey, data);
const message = await setLicense(confirmKey, data);
this.setLicenseUpload(message);
};