diff --git a/README.md b/README.md index 9214bed..2299792 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,14 @@ Go to the source directory and give the following command ```bash docker compose up --build ``` +## To run using AWS Backend (if docker compose fails) +Go to `client\data\apiRoutes` and comment the `first line` and uncomment the second +```js +export const baseUrl = "http://localhost:8585"; // Uncomment to run Locally +// export const baseUrl = "http://13.250.36.61"; // Uncomment to run in AWS +``` +When running on AWS the frontend might face some slow network problems which can be fixed by switching speed from no thorttling to fast 3G. [You can check this video to see the demonstration of the problem mentioned here](https://drive.google.com/drive/folders/1B5N5o0ms7mizSYm5HNiAjJj0O82Zb1tq?usp=sharing). + ## License [MIT](https://choosealicense.com/licenses/mit/) diff --git a/client/components/dataTables/BillBySTSId.tsx b/client/components/dataTables/BillBySTSId.tsx index 904c402..f216104 100644 --- a/client/components/dataTables/BillBySTSId.tsx +++ b/client/components/dataTables/BillBySTSId.tsx @@ -17,6 +17,7 @@ import EmptyFillContainer from "../dashboard-componenets/cards/EmptyFillContaine import { getCookie } from "@/lib/cookieFunctions"; import { admin } from "@/data/roles"; import { Button } from "../ui/button"; +import { baseUrl } from "@/data/apiRoutes"; const dummyDataArray: ScheduleEntry[] = [ { @@ -97,7 +98,7 @@ export function BillBySTSId({ stsId, date }: { stsId: string; date: string }) { try { // fetch data from api const res: any = await axios.get( - "http://localhost:8585/schedules/search?date=" + + baseUrl + "/schedules/search?date=" + date + "&stsId=" + stsId, @@ -126,7 +127,7 @@ export function BillBySTSId({ stsId, date }: { stsId: string; date: string }) { try { // fetch data from api const res: any = await axios.post( - "http://localhost:8585/schedules/create/" + date, + baseUrl + "/schedules/create/" + date, { headers: { Authorization: `Bearer ${localStorage.getItem(jwtToken)}`, diff --git a/client/data/apiRoutes.ts b/client/data/apiRoutes.ts index 9ec7b32..10610f5 100644 --- a/client/data/apiRoutes.ts +++ b/client/data/apiRoutes.ts @@ -1,4 +1,5 @@ -const baseUrl = "http://localhost:8585"; +export const baseUrl = "http://localhost:8585"; // Local +// export const baseUrl = "http://13.250.36.61"; // AWS export const apiRoutes = { auth: {