diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/.env.local b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/.env.local index 36d80dd..a58b264 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/.env.local +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/.env.local @@ -1,7 +1,8 @@ HOST = 0.0.0.0 PORT = 4848 -REACT_APP_API_SERVER = 192.168.0.134 +REACT_APP_API_SERVER = 192.168.0.118 REACT_APP_API_SERVER_PORT = 280 -REACT_APP_FLASK_SERVER = 192.168.0.134 +REACT_APP_API_CONTEXT = / +REACT_APP_FLASK_SERVER = 192.168.0.118 REACT_APP_FLASK_SERVER_PORT = 5000 GITHUB_SECRET = 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 diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/HighradiusWinterInternship.postman_collection.json b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/HighradiusWinterInternship.postman_collection.json deleted file mode 100644 index 304e39c..0000000 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/HighradiusWinterInternship.postman_collection.json +++ /dev/null @@ -1,210 +0,0 @@ -{ - "info": { - "_postman_id": "9bf771bd-5e17-403a-9fa2-701e0291adf5", - "name": "HighradiusWinterInternship", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "GetRows", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "url": { - "raw": "http://192.168.0.134:280/RESTDatabase_war_exploded/getrows?start=10&limit=2", - "protocol": "http", - "host": [ - "192", - "168", - "0", - "134" - ], - "port": "280", - "path": [ - "RESTDatabase_war_exploded", - "getrows" - ], - "query": [ - { - "key": "start", - "value": "10" - }, - { - "key": "limit", - "value": "2" - } - ] - } - }, - "response": [] - }, - { - "name": "AddRows", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"sl_no\":48558,\r\n \"business_code\": null,\r\n \"cust_number\": \"200020431\",\r\n \"clear_date\": \"2022-3-1\",\r\n \"business_year\": null,\r\n \"doc_id\": null,\r\n \"posting_date\": \"2022-3-1\",\r\n \"document_create_date\": \"2022-3-2\",\r\n \"document_create_date1\": null,\r\n \"due_in_date\": \"2022-3-19\",\r\n \"invoice_currency\": null,\r\n \"document_type\": null,\r\n \"posting_id\": null,\r\n \"area_business\": null,\r\n \"total_open_amount\": null,\r\n \"baseline_create_date\": \"2022-3-15\",\r\n \"cust_payment_terms\": null,\r\n \"invoice_id\": null,\r\n \"isOpen\": null,\r\n \"aging_bucket\": null,\r\n \"is_deleted\": null\r\n}" - }, - "url": { - "raw": "http://192.168.0.134:280/RESTDatabase_war_exploded/addRow", - "protocol": "http", - "host": [ - "192", - "168", - "0", - "134" - ], - "port": "280", - "path": [ - "RESTDatabase_war_exploded", - "addRow" - ] - } - }, - "response": [] - }, - { - "name": "Get Businesses", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "http://192.168.0.134:280/RESTDatabase_war_exploded/getbusinesses", - "protocol": "http", - "host": [ - "192", - "168", - "0", - "134" - ], - "port": "280", - "path": [ - "RESTDatabase_war_exploded", - "getbusinesses" - ] - } - }, - "response": [] - }, - { - "name": "Get Customers", - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "http://192.168.0.134:280/RESTDatabase_war_exploded/getcustomers", - "protocol": "http", - "host": [ - "192", - "168", - "0", - "134" - ], - "port": "280", - "path": [ - "RESTDatabase_war_exploded", - "getcustomers" - ] - } - }, - "response": [] - }, - { - "name": "Edit Rows", - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"invoice_currency\": \"USD\",\r\n \"cust_payment_terms\": \"NAA8\"\r\n}" - }, - "url": { - "raw": "http://192.168.0.134:280/RESTDatabase_war_exploded/editRow?serialNumber=2&tableName=winter_internship", - "protocol": "http", - "host": [ - "192", - "168", - "0", - "134" - ], - "port": "280", - "path": [ - "RESTDatabase_war_exploded", - "editRow" - ], - "query": [ - { - "key": "serialNumber", - "value": "2" - }, - { - "key": "tableName", - "value": "winter_internship" - } - ] - } - }, - "response": [] - }, - { - "name": "Delete Rows", - "request": { - "method": "DELETE", - "header": [ - { - "key": "Content-Type", - "value": "application/json", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://192.168.0.134:280/RESTDatabase_war_exploded/deleteRow?sl_no=35,", - "protocol": "http", - "host": [ - "192", - "168", - "0", - "134" - ], - "port": "280", - "path": [ - "RESTDatabase_war_exploded", - "deleteRow" - ], - "query": [ - { - "key": "sl_no", - "value": "35,", - "description": "Comma seprated string or a single serial_no" - } - ] - } - }, - "response": [] - } - ] -} \ No newline at end of file diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/advancedSearch.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/advancedSearch.js index 1736c74..90e66d5 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/advancedSearch.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/advancedSearch.js @@ -1,11 +1,11 @@ import { post } from 'axios'; -const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT } = process.env; +const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; const advancedSearch = async (payload) => { const URL = `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/advancedSearch`; + }${REACT_APP_API_CONTEXT||'/RESTDatabase_war_exploded'}/advancedSearch`; try { /* const payload = { @@ -34,7 +34,7 @@ const advancedSearch = async (payload) => { const { status, data } = await post( `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/getrows?start=${start}&limit=${limit}`, + }${REACT_APP_API_CONTEXT||'/RESTDatabase_war_exploded'}/getrows?start=${start}&limit=${limit}`, ); if (status === 200) { data[data.length - 3] = { ...data[data.length - 3], start, limit }; diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getAnalyticsData.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getAnalyticsData.js index c5e39ed..3c5c8e1 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getAnalyticsData.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getAnalyticsData.js @@ -1,7 +1,7 @@ import { post } from 'axios'; const getAnalyticsData = async (payload) => { - const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT } = process.env; + const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; /* const payload = { clear_date: ['2019-01-01', '2020-12-31'], due_in_date: ['2019-01-01', '2020-12-31'], @@ -11,9 +11,9 @@ const getAnalyticsData = async (payload) => { try { const { status, data } = await post( - `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ - REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/getanalytics`, + `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${REACT_APP_API_SERVER_PORT || '280'}${ + REACT_APP_API_CONTEXT || '/RESTDatabase_war_exploded' + }/getanalytics`, JSON.stringify(payload), ); diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getBusinesses.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getBusinesses.js index 9a2bddf..2e6f4b4 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getBusinesses.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getBusinesses.js @@ -1,9 +1,13 @@ import { get } from 'axios'; const doPost = async () => { + const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; + try { const { status, data } = await get( - 'http://192.168.0.134:280/RESTDatabase_war_exploded/getbusinesses', + `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${REACT_APP_API_SERVER_PORT || '280'}${ + REACT_APP_API_CONTEXT || '/RESTDatabase_war_exploded' + }/getbusinesses`, ); if (status === 200) { console.log('[API /getBusinesses] Response: 200 '); diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getCustomers.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getCustomers.js index 7abe264..8cefe59 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getCustomers.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getCustomers.js @@ -1,9 +1,13 @@ import { get } from 'axios'; const doGet = async () => { + const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; + try { const { status, data } = await get( - 'http://192.168.0.134:280/RESTDatabase_war_exploded/getcustomers', + `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ + REACT_APP_API_SERVER_PORT || '280' + }${REACT_APP_API_CONTEXT||'/RESTDatabase_war_exploded'}/getcustomers`, ); if (status === 200) { console.log('[API /getCustomers] Response: 200 '); diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getRows.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getRows.js index f0a2ec6..8d98c62 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getRows.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/getRows.js @@ -1,13 +1,13 @@ import { post } from 'axios'; const doPost = async ({ start = 0, limit = 10 }) => { - const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT } = process.env; + const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; try { const { status, data } = await post( - `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ - REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/getrows?start=${start}&limit=${limit}`, + `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${REACT_APP_API_SERVER_PORT || '280'}${ + REACT_APP_API_CONTEXT || '/RESTDatabase_war_exploded' + }/getrows?start=${start}&limit=${limit}`, ); if (status === 200) { data[data.length - 3] = { ...data[data.length - 3], start, limit }; diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleAddForm.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleAddForm.js index 573b92a..9515715 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleAddForm.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleAddForm.js @@ -1,11 +1,11 @@ import { post } from 'axios'; // This file is concerned with posting the addform to the server. -const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT } = process.env; +const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; const doSubmit = async (body) => { const URL = `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/addRow`; + }${REACT_APP_API_CONTEXT || '/RESTDatabase_war_exploded'}/addRow`; try { // Pass json body to axios post method. diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleDeleteRows.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleDeleteRows.js index f7f24d9..ee6afd1 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleDeleteRows.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleDeleteRows.js @@ -1,11 +1,11 @@ import axios from 'axios'; // This file is concerned with DELETE the deleteForm to the server. -const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT } = process.env; +const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; const doDelete = async (selectedIndices) => { const URL = `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/deleteRow`; + }${REACT_APP_API_CONTEXT || '/RESTDatabase_war_exploded'}/deleteRow`; // Loop through selectedIndices and append comma ',' to each index. const selectedIndicesString = selectedIndices.reduce((curr, next) => `${curr + next},`, ''); diff --git a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleEditForm.js b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleEditForm.js index a498f0e..4f6191d 100644 --- a/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleEditForm.js +++ b/Track 4_ReactJS_Web Development/Project/Frontend/hrc-dashboard/src/utils/api/handleEditForm.js @@ -1,11 +1,11 @@ import { post } from 'axios'; // This file is concerned with posting the editform to the server. -const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT } = process.env; +const { REACT_APP_API_SERVER, REACT_APP_API_SERVER_PORT, REACT_APP_API_CONTEXT } = process.env; const doSubmit = async (params, body) => { const URL = `http://${REACT_APP_API_SERVER || '192.168.0.134'}:${ REACT_APP_API_SERVER_PORT || '280' - }/RESTDatabase_war_exploded/editRow`; + }${REACT_APP_API_CONTEXT || '/RESTDatabase_war_exploded'}/editRow`; console.log(JSON.stringify(body)); try { // Post data to the server with params