,
+ redirectPath = "/"
+ ) =>
+ // eslint-disable-next-line react/display-name
+ (props: Props) => {
+ const [isAuthorized, setIsAuthorized] = useState(CheckState.initiated);
- useEffect(() => {
- //https://medium.com/javascript-in-plain-english/how-to-use-async-function-in-react-hook-useeffect-typescript-js-6204a788a435
- (async () => {
- const isAuthorized = await isLoggedIn();
- setIsAuthorized(isAuthorized ? CheckState.succeed : CheckState.failed);
- })();
- }, []);
+ useEffect(() => {
+ //https://medium.com/javascript-in-plain-english/how-to-use-async-function-in-react-hook-useeffect-typescript-js-6204a788a435
+ (async () => {
+ const isAuthorized = await isLoggedIn();
+ setIsAuthorized(isAuthorized ? CheckState.succeed : CheckState.failed);
+ })();
+ }, []);
- if (isAuthorized === CheckState.initiated) {
- return Checking if user is authorized
;
- }
+ if (isAuthorized === CheckState.initiated) {
+ return Checking if user is authorized
;
+ }
- if (isAuthorized === CheckState.failed) {
- return ;
- }
+ if (isAuthorized === CheckState.failed) {
+ return ;
+ }
- return ;
-};
+ return ;
+ };
diff --git a/src/utils/withOnChangeValue.test.tsx b/src/utils/withOnChangeValue.test.tsx
deleted file mode 100644
index 257d7101..00000000
--- a/src/utils/withOnChangeValue.test.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from "react";
-import { withOnChangeValue } from "./withOnChangeValue";
-import { InputText } from "components/GameSettingsForm/components/InputText";
-import { shallow } from "enzyme";
-
-describe("withOnChangeValue", () => {
- it("is a function", () => {
- expect(typeof withOnChangeValue).toBe("function");
- });
-
- it("calls original onChange", () => {
- const WrappedComponent = withOnChangeValue(InputText);
- const onChange = jest.fn();
-
- const wrapper = shallow();
- const event = {
- target: { value: "123" },
- };
- wrapper.simulate("change", event);
- expect(onChange).toHaveBeenCalledWith(event);
- });
-
- it("calls onChangeText", () => {
- const WrappedComponent = withOnChangeValue(InputText);
- const onChangeValue = jest.fn();
-
- const wrapper = shallow();
- const event = {
- target: { value: "123" },
- };
- wrapper.simulate("change", event);
- expect(onChangeValue).toHaveBeenCalledWith(event.target.value);
- });
-});
diff --git a/src/utils/withOnChangeValue.tsx b/src/utils/withOnChangeValue.tsx
index 69ccf455..aa8fb7df 100644
--- a/src/utils/withOnChangeValue.tsx
+++ b/src/utils/withOnChangeValue.tsx
@@ -1,17 +1,10 @@
-import React from "react";
-
/**
* см тесты в src/utils/withOnChangeValue.test.tsx
* @param Component
*/
-export const withOnChangeValue = (
- Component: React.ComponentType
-) => (
- props: P & {
- onChange?: (ev: React.ChangeEvent) => void;
- onChangeValue?: (newText: string) => void;
- }
-) => {
- // put your code here
- return null;
-};
+export const withOnChangeValue =
+
() =>
+ () => {
+ // put your code here
+ return null;
+ };
diff --git a/tsconfig.json b/tsconfig.json
index 045de2c7..793bc823 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"baseUrl": "./",
+ "outDir": "build",
"paths": {
"types/*": ["src/types/*"],
"components/*": ["src/components/*"],