From 8e918eb02a2343034d8e0ba34e0cc8d4b612d686 Mon Sep 17 00:00:00 2001 From: Nayan Hossain Date: Thu, 8 May 2025 22:07:48 +0600 Subject: [PATCH] feat: centralize the base url config in frontend js part --- frontend/config.js | 3 +++ frontend/src/dashboardApp.js | 4 +++- frontend/src/invoiceApp.js | 6 ++++-- frontend/src/menuApp.js | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 frontend/config.js diff --git a/frontend/config.js b/frontend/config.js new file mode 100644 index 0000000..658f9c7 --- /dev/null +++ b/frontend/config.js @@ -0,0 +1,3 @@ +export const config = { + baseURL: "http://localhost:8080" +}; \ No newline at end of file diff --git a/frontend/src/dashboardApp.js b/frontend/src/dashboardApp.js index 1f53f85..ce613fc 100644 --- a/frontend/src/dashboardApp.js +++ b/frontend/src/dashboardApp.js @@ -1,4 +1,6 @@ -const baseUrl = "http://localhost:8080/dashboard.php"; +import { config } from "../config"; + +const baseUrl = `${config.baseURL}/dashboard.php`; export function dashboardApp() { return { diff --git a/frontend/src/invoiceApp.js b/frontend/src/invoiceApp.js index 7cdcfc0..a57b6e8 100644 --- a/frontend/src/invoiceApp.js +++ b/frontend/src/invoiceApp.js @@ -1,5 +1,7 @@ -const baseUrl = "http://localhost:8080/invoice.php"; -const menuBaseUrl = "http://localhost:8080/menu.php"; +import { config } from "../config"; + +const baseUrl = `${config.baseURL}/invoice.php`; +const menuBaseUrl = `${config.baseURL}/menu.php`; export function invoiceApp() { return { diff --git a/frontend/src/menuApp.js b/frontend/src/menuApp.js index f9b5894..6ebc906 100644 --- a/frontend/src/menuApp.js +++ b/frontend/src/menuApp.js @@ -1,4 +1,6 @@ -const baseUrl = "http://localhost:8080/menu.php"; +import { config } from "../config"; + +const baseUrl = `${config.baseURL}/menu.php`; export function menuApp() { return {