diff --git a/media-store/README.md b/media-store/README.md
index 364e4173..80a39821 100644
--- a/media-store/README.md
+++ b/media-store/README.md
@@ -4,22 +4,33 @@ Welcome to your new project.
It contains these folders and files, following our recommended project layout:
-File or Folder | Purpose
----------|----------
-`app/` | Contains already bundled js code from [this repository](https://github.com/Dmitriynj/media-store-front)
-`db/` | your domain models and data go here
-`srv/` | your service models and code go here
-`package.json` | project metadata and configuration
-`readme.md` | this getting started guide
+| File or Folder | Purpose |
+| -------------- | ------------------------------------ |
+| `app/` | Contains frontend app on react |
+| `db/` | your domain models and data go here |
+| `srv/` | your service models and code go here |
+| `package.json` | project metadata and configuration |
+| `readme.md` | this getting started guide |
+## Start development steps
-## Next Steps
+- At first open a new terminal and run `npm run deploy`. It should create new sqlite source and fill initial data from `db/data`. You can browse database in any sqlite client
+- Run `cds watch`. This will start cds service on 4004 port in watch mode
+- Open `app` folder and run `npm run start`. This will start frontend dev server on 3000 port. It supports debug in chrome and hot reloading out of the box by create-react-app
+- Now all things are done for development
-- Open a new terminal and run `cds watch`
-- (in VS Code simply choose _**Terminal** > Run Task > cds watch_)
-- Start adding content, for example, a [db/schema.cds](db/schema.cds).
-- To adjust UI simply clone [this](https://github.com/Dmitriynj/media-store-front) repo. Run `yarn start` for development. When you are done, run `yarn build` and copy all files from '/build' to the '/app' folder of the current repo.
+## Deployment steps
+- Make sure you already have hanatrial instance in your cockpit dashboard (SAP Cloud Platform).
+ Or if you are using hana instance - change it in mta.yaml config file from hanatrial to hana
+- Replace `"kind": "sql"` with `"kind": "hana"` in package.json require section
+- Make sure that current folder does not contain any previous `*.mtar` build file and `gen` folder
+ If exists - remove it
+- Run `cf login` for Cloud Foundry authentication
+- Open `app` folder and run `npm run build`. This will start create new production frontend bundles
+- Run `mbt build -t ./`. This will create new build in `*.mtar` file
+- Run `cf deploy <.mtar file>` # for example, media-store_1.0.0.mtar
+- Now your services should be deployed with hanatrial instance and filled with initial data
## Learn More
diff --git a/media-store/app/src/api/axiosInstance.js b/media-store/app/src/api/axiosInstance.js
index abde261a..49fd0fa6 100644
--- a/media-store/app/src/api/axiosInstance.js
+++ b/media-store/app/src/api/axiosInstance.js
@@ -9,7 +9,7 @@ import { responseErrorInterceptor } from "./responseErrorInterceptor";
const axiosInstance = axios.create({
baseURL: API,
- timeout: 1000,
+ timeout: 2000,
});
const user = getUserFromLS();
const locale = getLocaleFromLS();
diff --git a/media-store/app/src/components/Editable.js b/media-store/app/src/components/Editable.js
deleted file mode 100644
index 72624c5a..00000000
--- a/media-store/app/src/components/Editable.js
+++ /dev/null
@@ -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 (
-
- );
-};
-
-export { Editable };
diff --git a/media-store/app/src/contexts/AppStateContext.js b/media-store/app/src/contexts/AppStateContext.js
index f2ea5eb2..e0029d6e 100644
--- a/media-store/app/src/contexts/AppStateContext.js
+++ b/media-store/app/src/contexts/AppStateContext.js
@@ -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);
};
diff --git a/media-store/app/src/hooks/useErrors.js b/media-store/app/src/hooks/useErrors.js
index 712ca779..086a5a04 100644
--- a/media-store/app/src/hooks/useErrors.js
+++ b/media-store/app/src/hooks/useErrors.js
@@ -19,7 +19,7 @@ const useErrors = () => {
setError({
status: "",
statusText: "Error",
- message: "Something went wrong",
+ message: "Something went wrong. Seems like request is too long",
});
}
diff --git a/media-store/app/src/pages/Login.js b/media-store/app/src/pages/Login.js
index a96de9d8..3efd5a6d 100644
--- a/media-store/app/src/pages/Login.js
+++ b/media-store/app/src/pages/Login.js
@@ -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) => {
diff --git a/media-store/app/src/pages/MyInvoicesPage.js b/media-store/app/src/pages/MyInvoicesPage.js
index a1edf62c..ba8f2813 100644
--- a/media-store/app/src/pages/MyInvoicesPage.js
+++ b/media-store/app/src/pages/MyInvoicesPage.js
@@ -178,7 +178,6 @@ const MyInvoicesPage = () => {
{invoiceElements && (