change readme.md. clean up console.logs. add check for exsisting invoices

This commit is contained in:
Dzmitry_Tamashevich@epam.com
2020-11-25 19:16:22 +03:00
committed by Daniel Hutzel
parent fe0562f38b
commit f439119e73
12 changed files with 60 additions and 86 deletions

View File

@@ -9,7 +9,7 @@ import { responseErrorInterceptor } from "./responseErrorInterceptor";
const axiosInstance = axios.create({
baseURL: API,
timeout: 1000,
timeout: 2000,
});
const user = getUserFromLS();
const locale = getLocaleFromLS();

View File

@@ -1,51 +0,0 @@
import React, { useEffect, useRef } from "react";
const Editable = ({ value, onChange, type }) => {
const inputRef = useRef();
useEffect(() => {
const { current } = inputRef;
current.value = value;
const handleFocus = () => {
console.log("input is focussed");
// current.disabled = false;
current.style.backgroundColor = "#f0f2f5";
};
const handleBlur = () => {
console.log("input is blurred");
// current.disabled = true;
current.style.backgroundColor = "white";
};
const handleInput = (e) => onChange(e.target.value);
current.addEventListener("focus", handleFocus);
current.addEventListener("blur", handleBlur);
current.addEventListener("input", handleInput);
return () => {
current.removeEventListener("focus", handleFocus);
current.removeEventListener("blur", handleBlur);
current.removeEventListener("input", handleInput);
};
});
return (
<input
ref={inputRef}
style={{
fontWeight: 600,
outline: "none",
border: "none",
backgroundColor: "white",
padding: "0 2px",
}}
type={type}
name="task"
/>
);
};
export { Editable };

View File

@@ -40,7 +40,6 @@ const AppStateContextProvider = ({ children }) => {
setUser(newUser);
};
emitter.on("UPDATE_USER", updateUser);
console.log("listener was registered");
return () => {
emitter.removeListener("UPDATE_USER", updateUser);
};

View File

@@ -19,7 +19,7 @@ const useErrors = () => {
setError({
status: "",
statusText: "Error",
message: "Something went wrong",
message: "Something went wrong. Seems like request is too long",
});
}

View File

@@ -25,14 +25,17 @@ const tailLayout = {
const Login = () => {
const [form] = Form.useForm();
const history = useHistory();
const { setLoading } = useAppState();
const { setLoading, setInvoicedItems } = useAppState();
const { handleError } = useErrors();
const onFinish = (values) => {
setLoading(true);
login({ email: values.email, password: values.password })
.then((response) => {
emitter.emit("UPDATE_USER", response.data);
.then(({ data: user }) => {
emitter.emit("UPDATE_USER", user);
if (user.roles.includes("employee")) {
setInvoicedItems([]);
}
history.push("/");
})
.catch((error) => {

View File

@@ -178,7 +178,6 @@ const MyInvoicesPage = () => {
{invoiceElements && (
<Collapse expandIconPosition="left">{invoiceElements}</Collapse>
)}
{"Pagination steel needed"}
</div>
);
};

View File

@@ -64,17 +64,13 @@ const PersonPage = () => {
};
const personProperties = map(Object.keys(person), (currentKey) => (
<Form.Item
key={currentKey}
label={PERSON_PROP[currentKey]}
name={currentKey}
>
<Input />
</Form.Item>
<div key={currentKey}>
<Form.Item label={PERSON_PROP[currentKey]} name={currentKey}>
<Input />
</Form.Item>
</div>
));
console.log(person, "person");
return (
<>
{person.lastName !== "" && (

View File

@@ -10,8 +10,6 @@ import { useAbortableEffect } from "../hooks/useAbortableEffect";
import { requireEmployee } from "../util/constants";
import "./TracksPage.css";
let counter = 0;
const { Search } = Input;
const { Option } = Select;
@@ -52,7 +50,6 @@ const TracksContainer = () => {
const getTracksRequest = fetchTacks();
const getGenresReq = fetchGenres();
console.log("calling requests", counter++);
Promise.all([countTracksReq, getTracksRequest, getGenresReq])
.then(
([

View File

@@ -49,7 +49,6 @@ const EditAction = ({
};
const handleCancel = () => {
console.log("Clicked cancel button");
setVisible(false);
};