mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 08:10:32 +00:00
chore: Refactoring all import directories to alias and all .js|.jsx renamed to be .ts|.tsx
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import Icon from 'components/Icon';
|
||||
import moment from 'moment';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Icon } from '@/components/Icon';
|
||||
|
||||
export default function AuthCopyright() {
|
||||
return (
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import InviteAcceptForm from './InviteAcceptForm';
|
||||
import AuthInsider from 'containers/Authentication/AuthInsider';
|
||||
import AuthInsider from '@/containers/Authentication/AuthInsider';
|
||||
import { InviteAcceptProvider } from './InviteAcceptProvider';
|
||||
|
||||
/**
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from 'react';
|
||||
import { Intent, Position } from '@blueprintjs/core';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Formik } from 'formik';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Intent, Position } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from '@/components';
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
import { useInviteAcceptContext } from './InviteAcceptProvider';
|
||||
import { AppToaster } from 'components';
|
||||
import { AppToaster } from '@/components';
|
||||
import { InviteAcceptSchema } from './utils';
|
||||
import InviteAcceptFormContent from './InviteAcceptFormContent';
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Button, InputGroup, Intent, FormGroup } from '@blueprintjs/core';
|
||||
import { Form, ErrorMessage, FastField, useFormikContext } from 'formik';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { inputIntent } from 'utils';
|
||||
import { Col, Row } from 'components';
|
||||
import { Col, Row, FormattedMessage as T } from '@/components';
|
||||
import { inputIntent } from '@/utils';
|
||||
import { useInviteAcceptContext } from './InviteAcceptProvider';
|
||||
import { PasswordRevealer } from './components';
|
||||
|
||||
/**
|
||||
* Invite user form.
|
||||
*/
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { createContext, useContext } from 'react';
|
||||
import { useInviteMetaByToken, useAuthInviteAccept } from 'hooks/query';
|
||||
import { useInviteMetaByToken, useAuthInviteAccept } from '@/hooks/query';
|
||||
import { InviteAcceptLoading } from './components';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Formik } from 'formik';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { AppToaster as Toaster, FormattedMessage as T } from '@/components';
|
||||
|
||||
import Toaster from 'components/AppToaster';
|
||||
import AuthInsider from 'containers/Authentication/AuthInsider';
|
||||
import { useAuthLogin } from 'hooks/query';
|
||||
import AuthInsider from '@/containers/Authentication/AuthInsider';
|
||||
import { useAuthLogin } from '@/hooks/query';
|
||||
|
||||
import LoginForm from './LoginForm';
|
||||
import { LoginSchema, transformLoginErrorsToToasts } from './utils';
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
Checkbox,
|
||||
} from '@blueprintjs/core';
|
||||
import { Form, ErrorMessage, Field } from 'formik';
|
||||
import { T } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
import { T } from '@/components';
|
||||
import { inputIntent } from '@/utils';
|
||||
import { PasswordRevealer } from './components';
|
||||
|
||||
/**
|
||||
@@ -1,16 +1,12 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Formik } from 'formik';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import AuthInsider from 'containers/Authentication/AuthInsider';
|
||||
import {
|
||||
useAuthLogin,
|
||||
useAuthRegister,
|
||||
} from '../../hooks/query/authentication';
|
||||
import { AppToaster, FormattedMessage as T } from '@/components';
|
||||
import AuthInsider from '@/containers/Authentication/AuthInsider';
|
||||
import { useAuthLogin, useAuthRegister } from '@/hooks/query/authentication';
|
||||
|
||||
import RegisterForm from './RegisterForm';
|
||||
import { RegisterSchema, transformRegisterErrorsToForm } from './utils';
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import {
|
||||
Button,
|
||||
InputGroup,
|
||||
@@ -7,12 +8,11 @@ import {
|
||||
Spinner,
|
||||
} from '@blueprintjs/core';
|
||||
import { ErrorMessage, Field, Form } from 'formik';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { FormattedMessage as T } from '@/components';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Row, Col, If } from 'components';
|
||||
import { Row, Col, If } from '@/components';
|
||||
import { PasswordRevealer } from './components';
|
||||
import { inputIntent } from 'utils';
|
||||
import { inputIntent } from '@/utils';
|
||||
|
||||
/**
|
||||
* Register form.
|
||||
@@ -1,17 +1,13 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { Formik } from 'formik';
|
||||
import {
|
||||
Intent,
|
||||
Position,
|
||||
} from '@blueprintjs/core';
|
||||
import { Link, useParams, useHistory } from 'react-router-dom';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Formik } from 'formik';
|
||||
import { Intent, Position } from '@blueprintjs/core';
|
||||
import { Link, useParams, useHistory } from 'react-router-dom';
|
||||
import { AppToaster, FormattedMessage as T } from '@/components';
|
||||
|
||||
import { useAuthResetPassword } from 'hooks/query';
|
||||
import { useAuthResetPassword } from '@/hooks/query';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import AuthInsider from 'containers/Authentication/AuthInsider';
|
||||
import AuthInsider from '@/containers/Authentication/AuthInsider';
|
||||
|
||||
import ResetPasswordForm from './ResetPasswordForm';
|
||||
import { ResetPasswordSchema } from './utils';
|
||||
@@ -19,7 +15,6 @@ import { ResetPasswordSchema } from './utils';
|
||||
* Reset password page.
|
||||
*/
|
||||
export default function ResetPassword() {
|
||||
|
||||
const { token } = useParams();
|
||||
const history = useHistory();
|
||||
|
||||
@@ -47,17 +42,23 @@ export default function ResetPassword() {
|
||||
history.push('/auth/login');
|
||||
setSubmitting(false);
|
||||
})
|
||||
.catch(({ response: { data: { errors } } }) => {
|
||||
if (errors.find((e) => e.type === 'TOKEN_INVALID')) {
|
||||
AppToaster.show({
|
||||
message: intl.get('an_unexpected_error_occurred'),
|
||||
intent: Intent.DANGER,
|
||||
position: Position.BOTTOM,
|
||||
});
|
||||
history.push('/auth/login');
|
||||
}
|
||||
setSubmitting(false);
|
||||
});
|
||||
.catch(
|
||||
({
|
||||
response: {
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
if (errors.find((e) => e.type === 'TOKEN_INVALID')) {
|
||||
AppToaster.show({
|
||||
message: intl.get('an_unexpected_error_occurred'),
|
||||
intent: Intent.DANGER,
|
||||
position: Position.BOTTOM,
|
||||
});
|
||||
history.push('/auth/login');
|
||||
}
|
||||
setSubmitting(false);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -82,4 +83,4 @@ export default function ResetPassword() {
|
||||
</div>
|
||||
</AuthInsider>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Button, InputGroup, Intent, FormGroup } from '@blueprintjs/core';
|
||||
import { Form, ErrorMessage, FastField } from 'formik';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
import { FormattedMessage as T } from '@/components';
|
||||
import { inputIntent } from '@/utils';
|
||||
|
||||
/**
|
||||
* Reset password form.
|
||||
@@ -1,17 +1,19 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Formik } from 'formik';
|
||||
import { Link, useHistory } from 'react-router-dom';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { useAuthSendResetPassword } from 'hooks/query';
|
||||
import Toaster from 'components/AppToaster';
|
||||
import { AppToaster, FormattedMessage as T } from '@/components';
|
||||
import { useAuthSendResetPassword } from '@/hooks/query';
|
||||
|
||||
import SendResetPasswordForm from './SendResetPasswordForm';
|
||||
import { SendResetPasswordSchema, transformSendResetPassErrorsToToasts } from './utils';
|
||||
import {
|
||||
SendResetPasswordSchema,
|
||||
transformSendResetPassErrorsToToasts,
|
||||
} from './utils';
|
||||
|
||||
import AppToaster from 'components/AppToaster';
|
||||
import AuthInsider from 'containers/Authentication/AuthInsider';
|
||||
import AuthInsider from '@/containers/Authentication/AuthInsider';
|
||||
|
||||
/**
|
||||
* Send reset password page.
|
||||
@@ -40,14 +42,20 @@ export default function SendResetPassword({ requestSendResetPassword }) {
|
||||
history.push('/auth/login');
|
||||
setSubmitting(false);
|
||||
})
|
||||
.catch(({ response: { data: { errors } } }) => {
|
||||
const toastBuilders = transformSendResetPassErrorsToToasts(errors);
|
||||
.catch(
|
||||
({
|
||||
response: {
|
||||
data: { errors },
|
||||
},
|
||||
}) => {
|
||||
const toastBuilders = transformSendResetPassErrorsToToasts(errors);
|
||||
|
||||
toastBuilders.forEach((builder) => {
|
||||
Toaster.show(builder);
|
||||
});
|
||||
setSubmitting(false);
|
||||
});
|
||||
toastBuilders.forEach((builder) => {
|
||||
AppToaster.show(builder);
|
||||
});
|
||||
setSubmitting(false);
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Button, InputGroup, Intent, FormGroup } from '@blueprintjs/core';
|
||||
import { Form, ErrorMessage, FastField } from 'formik';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { inputIntent } from 'utils';
|
||||
import { FormattedMessage as T } from '@/components';
|
||||
import { inputIntent } from '@/utils';
|
||||
|
||||
/**
|
||||
* Send reset password form.
|
||||
@@ -1,8 +1,7 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import ContentLoader from 'react-content-loader';
|
||||
import { If, Icon } from 'components';
|
||||
import { saveInvoke } from 'utils';
|
||||
import { If, Icon, FormattedMessage as T } from '@/components';
|
||||
import { saveInvoke } from '@/utils';
|
||||
|
||||
export function PasswordRevealer({ defaultShown = false, onChange }) {
|
||||
const [shown, setShown] = React.useState(defaultShown);
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Yup from 'yup';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
import intl from 'react-intl-universal';
|
||||
import { Intent } from '@blueprintjs/core';
|
||||
|
||||
export const LOGIN_ERRORS = {
|
||||
INVALID_DETAILS: 'INVALID_DETAILS',
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isAuthenticated } from 'store/authentication/authentication.reducer';
|
||||
import { isAuthenticated } from '@/store/authentication/authentication.reducer';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
export default (mapState) => {
|
||||
Reference in New Issue
Block a user