Refactor: Move configuration exports (API_URL, IS_DEV, POS_STEP_1_VERSION) to dedicated config file and update imports across components
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
<link rel="stylesheet" href="bulma/css/bulma.min.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css" integrity="sha512-5Hs3dF2AEPkpNAR7UiOHba+lRSJNeM2ECkwxUIxC1Q/FLycGTbNapWXB4tP889k5T5Ju8fs4b1P5z/iB4nMfSQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
||||
<title>Truck Wash</title>
|
||||
</head>
|
||||
|
||||
@@ -6,7 +6,7 @@ import ShowErrorField from "@/components/global/ShowErrorField.vue";
|
||||
import bulmaCalendar from "bulma-calendar";
|
||||
import 'bulma-calendar/src/scss/index.scss';
|
||||
import Swal from "sweetalert2";
|
||||
import {IS_DEV} from "@/main.js";
|
||||
import {IS_DEV} from "@/config.js";
|
||||
|
||||
const props = defineProps({
|
||||
form_identifier: {
|
||||
@@ -743,4 +743,4 @@ const debugGetForm = () => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -10,7 +10,7 @@ import ButtonsBox from "@/components/displays/boxes/ButtonsBox.vue";
|
||||
import { isCustomerSelected, department_id, getDepartment, reg_1 } from "@/components/shop/POSDepartmentProcess.vue";
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
import ElementTabsBox from "@/components/displays/boxes/ElementTabsBox.vue";
|
||||
import {POS_STEP_1_VERSION} from "@/main.js";
|
||||
import {POS_STEP_1_VERSION} from "@/config.js";
|
||||
import SelectVehicleFormPOS from "@/components/forms/department/pos/SelectVehicleFormPOS.vue";
|
||||
import PosLastScannedLicensePlatesV2 from "@/components/displays/department/pos/PosLastScannedLicensePlatesV2.vue";
|
||||
import { deleteEverything } from "@/components/shop/POSDepartmentProcess.vue";
|
||||
@@ -371,4 +371,4 @@ const getPotentialDuplicateOrders = computed(() => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import {useSlots, defineProps} from 'vue';
|
||||
import {IS_DEV} from "@/main.js";
|
||||
import {IS_DEV} from "@/config.js";
|
||||
const props = defineProps(['permission']);
|
||||
const slots = useSlots();
|
||||
|
||||
@@ -41,4 +41,4 @@ const checkAccess = () => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useStore } from 'vuex'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
import { parseError, errors, clearErrors, addError, getError } from "@/components/request/HandleGlobalError.vue";
|
||||
import LoadButtonWhileAwait from "@/components/request/LoadButtonWhileAwait.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
@@ -161,4 +161,4 @@ SessionUser.auth.reCAPTCHA.preCheck.get().then((response) => {
|
||||
.is-selected-custom {
|
||||
border: 1px solid #3273dc;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useStore } from 'vuex'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
import { parseError, errors, clearErrors, addError, getError } from "@/components/request/HandleGlobalError.vue";
|
||||
import LoadButtonWhileAwait from "@/components/request/LoadButtonWhileAwait.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getScanners = () => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -47,4 +47,4 @@ export const editScanner = (id, department_id, name, notes) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getScans = () => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -44,4 +44,4 @@ export const createScan = (scanner_api_key, numberplate) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref, inject, provide } from 'vue';
|
||||
import axios from "axios";
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
import { parseError, clearErrors } from "@/components/request/HandleGlobalError.vue";
|
||||
|
||||
export const PaginatedListKey = Symbol('PaginatedList');
|
||||
@@ -347,4 +347,4 @@ export const paginatedGetRequest = globalInstance.paginatedGetRequest;
|
||||
export const loadList = globalInstance.loadList;
|
||||
export const getFilter = globalInstance.getFilter;
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import {ref} from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
import { parseError } from "@/components/request/HandleGlobalError.vue";
|
||||
import {SessionUser} from "@/components/session/token/SessionUser.vue";
|
||||
import {authenticatedRequest} from "@/components/session/authenticatedRequest.vue";
|
||||
@@ -43,4 +43,4 @@ export const searchCustomer = (search = null, filter = false) => {
|
||||
parseError(error);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const currentDepartment = ref(null);
|
||||
export const selectDepartment = (department) => {
|
||||
@@ -145,4 +145,4 @@ export const createUserDiscount = (userId, objectId, discount, isCategory) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const authenticatedRequest = (url, method, data, catchCallable = null, thenCallable = null) => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -70,4 +70,4 @@ export const paginatedGetRequest = (url, currentPage, itemsPerPage) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const unauthenticatedRequest = (url, method, data) => {
|
||||
return axios({
|
||||
@@ -10,4 +10,4 @@ export const unauthenticatedRequest = (url, method, data) => {
|
||||
data,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getAttributes = (customer_number) => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -75,4 +75,4 @@ export const deleteAttribute = (customer_number, attribute) => {
|
||||
}
|
||||
);
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getNotes = (customer_number) => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -41,4 +41,4 @@ export const deleteNote = (id) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue";
|
||||
import axios from "axios";
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
@@ -31,4 +31,4 @@ const download = (booking_id) => {
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getOrders = () => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -89,4 +89,4 @@ export const editOrderNotes = (id, notes) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getOrderItems = (order_id) => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -63,4 +63,4 @@ export const editOrderItem = (id, price, notes, reference, quantity) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import {computed, ref, watch} from 'vue';
|
||||
import axios from 'axios';
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
import { getScansDepartmentPagination } from "@/components/numberplatescanners/Scans.vue";
|
||||
import {useRouter} from "vue-router";
|
||||
import { parseError, clearErrors } from "@/components/request/HandleGlobalError.vue";
|
||||
@@ -1165,4 +1165,4 @@ export const getAttachmentPreviewLink = (attachmentId) => {
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import axios from 'axios'
|
||||
import {API_URL} from "@/main.js";
|
||||
import {API_URL} from "@/config.js";
|
||||
|
||||
export const getProducts = (departmentId = null, final_price = true, customer_number = null) => {
|
||||
const token = localStorage.getItem('token');
|
||||
@@ -90,4 +90,4 @@ export const editProduct = (id, name, description, price, category, piktogram, e
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ref } from "vue";
|
||||
import { parseError, getError, removeError } from "@/components/request/HandleGlobalError.vue";
|
||||
import GenericButton from "@/components/viewport/page/templates/generic/graphics/GenericButton.vue";
|
||||
import ShowErrorField from "@/components/global/ShowErrorField.vue";
|
||||
import { API_URL } from "@/main"; // Import API_URL from main configuration
|
||||
import { API_URL } from "@/config"; // Import API_URL from config configuration
|
||||
/** Define reactive state variables */
|
||||
const isCheckingUpdates = ref(false);
|
||||
const updateAvailable = ref(false);
|
||||
|
||||
+2
-5
@@ -13,11 +13,8 @@ import App from "@/App.vue";
|
||||
import Buefy from 'buefy'
|
||||
import 'buefy/dist/css/buefy.css'
|
||||
|
||||
export const IS_DEV = import.meta.env.VITE_IS_DEV; // Set to false in production
|
||||
|
||||
// Development mode
|
||||
export const POS_STEP_1_VERSION = 2; //(IS_DEV ? 2 : 1);
|
||||
export const API_URL = (IS_DEV ? 'https://api.truckwash.dk:4433' : 'https://api.truckwash.dk');
|
||||
import { API_URL, IS_DEV, POS_STEP_1_VERSION } from './config';
|
||||
export { API_URL, IS_DEV, POS_STEP_1_VERSION };
|
||||
|
||||
// Service worker update handling
|
||||
if ('serviceWorker' in navigator) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Colors } from "@/ThemeConfig.vue";
|
||||
import {defineProps, ref} from "vue";
|
||||
import { defineSlots } from "vue";
|
||||
import UserNavigationTop from "@/components/displays/user/UserNavigationTop.vue";
|
||||
import {IS_DEV} from "@/main.js";
|
||||
import {IS_DEV} from "@/config.js";
|
||||
|
||||
defineProps({
|
||||
title: String,
|
||||
@@ -146,4 +146,4 @@ const applyScreenDependingClasses = (shouldApply, classes) => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
</style>
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import DepartmentDashboardPageWrapper from "@/views/dashboards/departmentDashboard/DepartmentDashboardPageWrapper.vue";
|
||||
import NotFoundFallBackPageWrapper from "@/components/page/wrappers/NotFoundFallBackPageWrapper.vue";
|
||||
import Calendar from "@/components/timebookings/TimeBookingsCalendar.vue";
|
||||
import {IS_DEV} from "@/main.js";
|
||||
import {IS_DEV} from "@/config.js";
|
||||
import TimeBookingsPagination from "@/components/displays/pagination/models/DepartmentPos/TimeBookingsPagination.vue";
|
||||
</script>
|
||||
|
||||
@@ -26,4 +26,4 @@ import TimeBookingsPagination from "@/components/displays/pagination/models/Depa
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user