-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/imports/ProductForm.vue b/app/components/imports/ProductForm.vue
index 26a0b37..73b0b0d 100644
--- a/app/components/imports/ProductForm.vue
+++ b/app/components/imports/ProductForm.vue
@@ -30,16 +30,14 @@ const body = ref($copy(defaultBody.value));
const productVariant = ref();
onMounted(async () => {
if (props.variantId) {
- const variant = await $getdata(
- "Product_Variant",
- undefined,
- {
+ const variant = await $getdata("Product_Variant", {
+ first: true,
+ params: {
filter: { id: props.variantId },
values:
"id,code,product,product__name,product__os,product__manufacturer,product__battery,product__screen,product__cpu,product__gpu,product__camera_system,product__sim,product__network_technology,product__charging_technology,product__external_storage,product__ip_rating,product__design,color,color__code,color__name,color__hex_code,ram,ram__code,ram__capacity,internal_storage,internal_storage__code,internal_storage__capacity,image,image__path,price,note,create_time,update_time",
},
- true,
- );
+ });
productVariant.value = variant;
@@ -64,6 +62,10 @@ onMounted(async () => {
}
});
+watch(body, (newVal) => {
+ console.dir("body changed", newVal);
+});
+
const isDirty = computed(() => !isEqual(body.value, defaultBody.value));
function selected(field, data) {
diff --git a/app/components/imports/ProductVariantForm.vue b/app/components/imports/ProductVariantForm.vue
index 79903de..f9a840e 100644
--- a/app/components/imports/ProductVariantForm.vue
+++ b/app/components/imports/ProductVariantForm.vue
@@ -27,16 +27,14 @@ const productVariant = ref();
onMounted(async () => {
// if props.variant (edit), fetch data to fill in body
if (props.variantId) {
- const variant = await $getdata(
- "Product_Variant",
- undefined,
- {
+ const variant = await $getdata("Product_Variant", {
+ first: true,
+ params: {
filter: { id: props.variantId },
values:
"id,code,product,product__name,product__os,product__manufacturer,product__battery,product__screen,product__cpu,product__gpu,product__camera_system,product__sim,product__network_technology,product__charging_technology,product__external_storage,product__ip_rating,product__design,color,color__code,color__name,color__hex_code,ram,ram__code,ram__capacity,internal_storage,internal_storage__code,internal_storage__capacity,image,image__path,price,note,create_time,update_time",
},
- true,
- );
+ });
productVariant.value = variant;
diff --git a/app/components/marketing/email/viewEmail/ViewEmail.vue b/app/components/marketing/email/viewEmail/ViewEmail.vue
index 4ad4dbb..5c2b6b5 100644
--- a/app/components/marketing/email/viewEmail/ViewEmail.vue
+++ b/app/components/marketing/email/viewEmail/ViewEmail.vue
@@ -55,7 +55,7 @@ const isVietnamese = computed(() => $store.lang.toLowerCase() === "vi");
const paymentScheduleItem = ref(null);
const contentPaymentQR = ref("");
-const emailTemplate = await $getdata("emailtemplate", { id: props.idEmailTemplate }, undefined, false);
+const emailTemplate = await $getdata("emailtemplate", { filter: { id: props.idEmailTemplate }, first: true });
templateEmailContent.value = emailTemplate[0] ?? null;
diff --git a/app/components/media/FileCount.vue b/app/components/media/FileCount.vue
index 067a80a..174db10 100644
--- a/app/components/media/FileCount.vue
+++ b/app/components/media/FileCount.vue
@@ -18,8 +18,10 @@ export default {
let obj;
if (this.attr === "image_count") {
let rs = await this.$getdata(this.api, {
- ref: this.row.id,
- file__type: 2,
+ filter: {
+ ref: this.row.id,
+ file__type: 2,
+ },
});
if (rs.length > 0) {
obj = {
diff --git a/app/components/media/FileGallery.vue b/app/components/media/FileGallery.vue
index 30ad17b..3b53a29 100644
--- a/app/components/media/FileGallery.vue
+++ b/app/components/media/FileGallery.vue
@@ -40,8 +40,10 @@ export default {
},
async created() {
this.files = await this.$getdata(this.api, {
- ref: this.row.id,
- file__type: 1,
+ filter: {
+ ref: this.row.id,
+ file__type: 1,
+ },
});
if (this.files.length > 0)
this.vbind = {
diff --git a/app/components/media/FileInfo.vue b/app/components/media/FileInfo.vue
index b5c70d3..7efe144 100644
--- a/app/components/media/FileInfo.vue
+++ b/app/components/media/FileInfo.vue
@@ -41,7 +41,7 @@ export default {
};
},
async created() {
- this.record = await this.$getdata("file", { id: this.row.file || this.row.id }, undefined, true);
+ this.record = await this.$getdata("file", { filter: { id: this.row.file || this.row.id }, first: true });
},
methods: {
async save() {
diff --git a/app/components/media/FileList.vue b/app/components/media/FileList.vue
index 15b54a4..0f057d9 100644
--- a/app/components/media/FileList.vue
+++ b/app/components/media/FileList.vue
@@ -23,8 +23,10 @@ export default {
async created() {
this.pagedata = this.$getpage();
this.files = await this.$getdata(this.api, {
- ref: this.row.id,
- file__type: 1,
+ filter: {
+ ref: this.row.id,
+ file__type: 1,
+ },
});
this.vbind = {
pagename: this.pagename1,
@@ -62,7 +64,7 @@ export default {
});
if (this.pagename) {
let vapi = this.api.replace("file", "");
- let ele = await this.$getdata(vapi, { id: this.row.id }, undefined, true);
+ let ele = await this.$getdata(vapi, { filter: { id: this.row.id }, first: true });
this.$updatepage(this.pagename, ele);
}
},
diff --git a/app/components/media/ImageGallery.vue b/app/components/media/ImageGallery.vue
index 4f48bac..b2c155a 100644
--- a/app/components/media/ImageGallery.vue
+++ b/app/components/media/ImageGallery.vue
@@ -67,7 +67,7 @@ export default {
},
},
async created() {
- this.files = await this.$getdata(this.api, { ref: this.row.id }); //file__type: 2
+ this.files = await this.$getdata(this.api, { filter: { ref: this.row.id } }); //file__type: 2
},
methods: {
async remove(v, i) {
@@ -85,7 +85,7 @@ export default {
this.files = this.files.concat(rs);
if (this.pagename) {
let vapi = this.vapi ? this.vapi : this.api.replace("file", "");
- let ele = await this.$getdata(vapi, { id: this.row.id }, undefined, true);
+ let ele = await this.$getdata(vapi, { filter: { id: this.row.id }, first: true });
this.$updatepage(this.pagename, ele);
}
},
diff --git a/app/components/media/ImageLayout.vue b/app/components/media/ImageLayout.vue
index 6e0b21f..50c5c29 100644
--- a/app/components/media/ImageLayout.vue
+++ b/app/components/media/ImageLayout.vue
@@ -206,10 +206,12 @@ const layoutMode = ref(layoutModes.GRID);
const convertToWebp = ref(false);
const webpQuality = ref(80);
-const project = await $getdata("project", { id: props.projectId }, undefined, true);
+const project = await $getdata("project", { filter: { id: props.projectId }, first: true });
const images = ref([]);
const isForProduct = computed(() => props.productId !== undefined);
-const product = isForProduct.value ? await $getdata("product", { id: props.productId }, undefined, true) : undefined;
+const product = isForProduct.value
+ ? await $getdata("product", { filter: { id: props.productId }, first: true })
+ : undefined;
const showmodal = ref();
const imgshow = ref([]);
const hashtag = ref();
@@ -219,17 +221,21 @@ async function loadImages() {
const values =
"id,file__hashtag,file__code,file,create_time,file__code,file__type,file__doc_type,file__name,file__file,file__size,file__caption,file__user__fullname,";
- const projectImages = await $getdata("projectfile", undefined, {
- filter: { project: project.id, file__type: 2 },
- values: values + "project",
- sort: "-create_time",
+ const projectImages = await $getdata("projectfile", {
+ params: {
+ filter: { project: project.id, file__type: 2 },
+ values: values + "project",
+ sort: "-create_time",
+ },
});
if (isForProduct.value) {
const productImages = await $getdata("productfile", undefined, {
- filter: { product: props.productId, file__type: 2 },
- values: values + "product",
- sort: "-create_time",
+ params: {
+ filter: { product: props.productId, file__type: 2 },
+ values: values + "product",
+ sort: "-create_time",
+ },
});
const sameTemplateImages = projectImages.filter((img) => img.file__name.startsWith(product.template_name));
diff --git a/app/components/media/ImageShow.vue b/app/components/media/ImageShow.vue
index 6505b19..49e73d7 100644
--- a/app/components/media/ImageShow.vue
+++ b/app/components/media/ImageShow.vue
@@ -63,7 +63,7 @@ export default {
},
async created() {
let arr = [];
- let files = await this.$getdata("file", { file__in: this.image });
+ let files = await this.$getdata("file", { filter: { file__in: this.image } });
this.image.map((v) => {
let found = this.$find(files, { file: v });
arr.push({ image: `${this.$getpath()}download/?name=${v}`, file: found });
diff --git a/app/components/media/Imagebox.vue b/app/components/media/Imagebox.vue
index 7b611e6..a5c5df2 100644
--- a/app/components/media/Imagebox.vue
+++ b/app/components/media/Imagebox.vue
@@ -298,9 +298,9 @@ export default {
this.timer = setTimeout(() => this.startSearch(e.target.value), 150);
},
async startSearch(value) {
- let filter = { user: this.login.id };
+ const filter = { user: this.login.id };
if (!this.$empty(value)) filter.name__icontains = value.toLowerCase();
- this.data = await this.$getdata("file", filter);
+ this.data = await this.$getdata("file", { filter });
},
displayInput() {
this.showUrl = true;
diff --git a/app/components/menu/MenuCollab.vue b/app/components/menu/MenuCollab.vue
index 3f71371..2cdea42 100644
--- a/app/components/menu/MenuCollab.vue
+++ b/app/components/menu/MenuCollab.vue
@@ -15,7 +15,10 @@ const props = defineProps({
row: Object,
});
async function open() {
- let record = await $getdata("collaborator", { code: props.row.collaborator__code }, undefined, true);
+ const record = await $getdata("collaborator", {
+ first: true,
+ filter: { code: props.row.collaborator__code },
+ });
emit("clickevent", {
name: "dataevent",
data: {
diff --git a/app/components/modal/InternalEntry.vue b/app/components/modal/InternalEntry.vue
index 8f5e8d7..625e6a5 100644
--- a/app/components/modal/InternalEntry.vue
+++ b/app/components/modal/InternalEntry.vue
@@ -319,7 +319,10 @@ export default {
if (parsedItem && parsedItem.code) {
try {
- const entryData = await $getdata("internalentry", { code: parsedItem.code }, undefined, true);
+ const entryData = await $getdata("internalentry", {
+ first: true,
+ filter: { code: parsedItem.code },
+ });
if (entryData) {
this.entries.push(entryData);
}
diff --git a/app/components/modal/Reservation.vue b/app/components/modal/Reservation.vue
index 826fc56..3b04be4 100644
--- a/app/components/modal/Reservation.vue
+++ b/app/components/modal/Reservation.vue
@@ -154,12 +154,10 @@ var contractData = ref(null);
const loadContract = async () => {
if (record.value.transaction__code) {
try {
- contractData.value = await $getdata(
- "contract",
- { transaction__code: record.value.transaction__code },
- undefined,
- true,
- );
+ contractData.value = await $getdata("contract", {
+ first: true,
+ filter: { transaction__code: record.value.transaction__code },
+ });
} catch (error) {
console.error("Error loading contract:", error);
contractData.value = null;
diff --git a/app/components/parameter/AllocationRules.vue b/app/components/parameter/AllocationRules.vue
deleted file mode 100644
index da7bcb4..0000000
--- a/app/components/parameter/AllocationRules.vue
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/Dealer.vue b/app/components/parameter/Dealer.vue
deleted file mode 100644
index 84ff3e5..0000000
--- a/app/components/parameter/Dealer.vue
+++ /dev/null
@@ -1,107 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/DeleteCart.vue b/app/components/parameter/DeleteCart.vue
deleted file mode 100644
index cadac15..0000000
--- a/app/components/parameter/DeleteCart.vue
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
- Không thể thực hiện thao tác vì giỏ hàng vẫn còn sản phẩm. Vui lòng xóa toàn bộ sản phẩm trong giỏ hàng trước
- khi tiếp tục.
-
-
-
-
- Bạn có chắc chắn muốn xóa giỏ hàng [{{ props.row.code.toUpperCase() }} – {{ props.row.name.toUpperCase() }}]
- không?
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/DeletePayable.vue b/app/components/parameter/DeletePayable.vue
deleted file mode 100644
index cbd5be5..0000000
--- a/app/components/parameter/DeletePayable.vue
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
- Bạn có chắc chắn muốn xóa lịch công nợ thời gian:
- {{ detail.time }} ngày - mẫu: [{{ detail.name?.toUpperCase() }}] không?
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/DiscountType.vue b/app/components/parameter/DiscountType.vue
deleted file mode 100644
index 97ab846..0000000
--- a/app/components/parameter/DiscountType.vue
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/DuePayables.vue b/app/components/parameter/DuePayables.vue
deleted file mode 100644
index 66f8775..0000000
--- a/app/components/parameter/DuePayables.vue
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/GiftType.vue b/app/components/parameter/GiftType.vue
deleted file mode 100644
index d46c6fd..0000000
--- a/app/components/parameter/GiftType.vue
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/ImportData.vue b/app/components/parameter/ImportData.vue
index 6382509..ac39bfb 100644
--- a/app/components/parameter/ImportData.vue
+++ b/app/components/parameter/ImportData.vue
@@ -163,7 +163,7 @@ export default {
};
},
async created() {
- this.setting = await this.$getdata("importsetting", { code: this.code }, undefined, true);
+ this.setting = await this.$getdata("importsetting", { first: true, filter: { code: this.code } });
this.requireFields = this.setting.detail;
},
beforeUnmount() {
diff --git a/app/components/parameter/NewCart.vue b/app/components/parameter/NewCart.vue
deleted file mode 100644
index 2130477..0000000
--- a/app/components/parameter/NewCart.vue
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/OverduePayables.vue b/app/components/parameter/OverduePayables.vue
deleted file mode 100644
index 923d23d..0000000
--- a/app/components/parameter/OverduePayables.vue
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/SalePolicy.vue b/app/components/parameter/SalePolicy.vue
deleted file mode 100644
index 28f4558..0000000
--- a/app/components/parameter/SalePolicy.vue
+++ /dev/null
@@ -1,471 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ errors.code }}
-
-
-
-
-
-
-
-
-
-
-
- {{ errors.name }}
-
-
-
-
-
-
-
-
-
-
-
- {{ errors.deposit }}
-
-
-
-
-
-
-
-
-
-
-
- {{ errors.method }}
-
-
-
-
-
-
-
-
-
-
-
- {{ errors.enable }}
-
-
-
-
-
-
-
-
-
-
-
-
- Xóa
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/components/parameter/TransactionPhase.vue b/app/components/parameter/TransactionPhase.vue
deleted file mode 100644
index 63b3d71..0000000
--- a/app/components/parameter/TransactionPhase.vue
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
diff --git a/app/components/people/PeopleInfo.vue b/app/components/people/PeopleInfo.vue
index b54d3a4..b70724b 100644
--- a/app/components/people/PeopleInfo.vue
+++ b/app/components/people/PeopleInfo.vue
@@ -339,7 +339,10 @@ async function update() {
if (!record.value.id) {
if (record.value.phone) {
record.value.phone = record.value.phone.trim();
- let obj = await $getdata("people", { phone: record.value.phone }, undefined, true);
+ let obj = await $getdata("people", {
+ first: true,
+ filter: { phone: record.value.phone },
+ });
if (obj) {
existedPeople = obj;
errors.value.phone = "Số điện thoại đã tồn tại.";
@@ -368,7 +371,7 @@ async function update() {
record.image.map((v) => arr.push({ ref: record.value.id, file: v }));
await $insertapi("customerfile", arr, undefined, false);
}
- let ele = await $getdata("people", { id: rs.id }, undefined, true);
+ let ele = await $getdata("people", { first: true, filter: { id: rs.id } });
emit("update", ele);
emit("modalevent", { name: "dataevent", data: ele });
if (props.pagename) $updatepage(props.pagename, ele);
diff --git a/app/components/people/PeopleView.vue b/app/components/people/PeopleView.vue
index f20f157..e579dd7 100644
--- a/app/components/people/PeopleView.vue
+++ b/app/components/people/PeopleView.vue
@@ -194,7 +194,10 @@ export default {
};
},
async created() {
- this.record = await this.$getdata("people", { id: this.row.people || this.row.id }, undefined, true);
+ this.record = await this.$getdata("people", {
+ first: true,
+ filter: { id: this.row.people || this.row.id },
+ });
},
methods: {
findLang(code) {
diff --git a/app/components/user/ConfirmCode.vue b/app/components/user/ConfirmCode.vue
index 23d67fd..10d60e9 100644
--- a/app/components/user/ConfirmCode.vue
+++ b/app/components/user/ConfirmCode.vue
@@ -51,7 +51,7 @@ export default {
methods: {
async confirm() {
if (this.checkError()) return this.$snackbar("Mã phê duyệt gồm 4 số từ 0-9");
- let user = await this.$getdata("user", undefined, { filter: { id: this.$store.state.login.id } }, true);
+ let user = await this.$getdata("user", { first: true, filter: { id: this.$store.state.login.id } });
user.approval_code = this.code;
await this.$updateapi("user", user);
},
diff --git a/app/components/user/EditUser.vue b/app/components/user/EditUser.vue
index d4d6a4b..d1fb48a 100644
--- a/app/components/user/EditUser.vue
+++ b/app/components/user/EditUser.vue
@@ -117,7 +117,10 @@ export default {
};
},
async created() {
- this.record = await this.$getdata("user", undefined, { filter: { id: this.row.id } }, true);
+ this.record = await this.$getdata("user", {
+ first: true,
+ filter: { id: this.row.id },
+ });
this.radioBlocked = this.record.blocked ? 1 : 0;
},
methods: {
@@ -158,12 +161,14 @@ export default {
this.$set(this.check, v.code, this.check[v.code] ? false : true);
},
async setTokenExpiry() {
- let rows = await this.$getdata("token", {
- user: this.record.id,
- expiry: 0,
+ const rows = await this.$getdata("token", {
+ filter: {
+ user: this.record.id,
+ expiry: 0,
+ },
});
if (rows.length === 0) return;
- rows.map((v) => (v.expiry = 1));
+ rows.forEach((v) => (v.expiry = 1));
this.$insertapi("token", rows, undefined, true);
},
},
diff --git a/app/components/user/NewUser.vue b/app/components/user/NewUser.vue
index 1257a7a..5065f69 100644
--- a/app/components/user/NewUser.vue
+++ b/app/components/user/NewUser.vue
@@ -321,7 +321,7 @@ export default {
if (this.checkError()) return;
let rs = await this.$insertapi("gethash", { text: this.password });
this.hash = rs.rows[0];
- let data = await this.$getdata("user", { username: this.username }, undefined, true);
+ let data = await this.$getdata("user", { first: true, filter: { username: this.username } });
if (data) {
return this.errors.push({
name: "username",
diff --git a/app/components/user/SetPassword.vue b/app/components/user/SetPassword.vue
index 42c501c..a68aa42 100644
--- a/app/components/user/SetPassword.vue
+++ b/app/components/user/SetPassword.vue
@@ -104,7 +104,10 @@ export default {
methods: {
async changePassword() {
if (!this.checkPassword()) return;
- let user = await this.$getdata("user", undefined, { filter: { id: this.row.id } }, true);
+ let user = await this.$getdata("user", {
+ first: true,
+ params: { filter: { id: this.row.id } },
+ });
let rs = await this.$insertapi("gethash", { text: this.password });
user.password = rs.rows[0];
let rs1 = await this.$updateapi("user", user);
diff --git a/app/components/user/UserInfo.vue b/app/components/user/UserInfo.vue
index 4c454e0..8b5ccb2 100644
--- a/app/components/user/UserInfo.vue
+++ b/app/components/user/UserInfo.vue
@@ -64,15 +64,13 @@ export default {
};
},
async created() {
- this.record = await this.$getdata(
- "user",
- undefined,
- {
+ this.record = await this.$getdata("user", {
+ first: true,
+ params: {
filter: { id: this.userId || this.store.login.id },
values: "id,username,fullname,type,type__name,create_time",
},
- true,
- );
+ });
},
};
diff --git a/app/layouts/default.vue b/app/layouts/default.vue
index 336a239..2b17cdb 100644
--- a/app/layouts/default.vue
+++ b/app/layouts/default.vue
@@ -57,15 +57,13 @@ function getViewport() {
async function checkRedirect() {
if (route.query.username && route.query.token) {
- let row = await $getdata(
- "user",
- null,
- {
+ let row = await $getdata("user", {
+ first: true,
+ params: {
filter: { username: route.query.username },
values: "id,avatar,username,fullname,type,type__code,type__name,is_admin",
},
- true,
- );
+ });
if (row === "error" || row === undefined) return; /* $requestLogin(); */
else {
row.token = route.query.token;
@@ -77,8 +75,8 @@ async function checkRedirect() {
async function checkLogin() {
if ($store.login ? $store.login.token : false) {
- $store.commit("rights", await $getdata("grouprights", { group: $store.login.type }));
- let authtoken = await $getdata("token", { token: $store.login.token }, undefined, true);
+ $store.commit("rights", await $getdata("grouprights", { filter: { group: $store.login.type } }));
+ let authtoken = await $getdata("token", { first: true, filter: { token: $store.login.token } });
if (authtoken ? authtoken.expiry : true) return; /* $requestLogin(); */
authorized.value = true;
}
diff --git a/app/plugins/02-connection.js b/app/plugins/02-connection.js
index 053603f..5839a14 100644
--- a/app/plugins/02-connection.js
+++ b/app/plugins/02-connection.js
@@ -1169,9 +1169,9 @@ export default defineNuxtPlugin((nuxtApp) => {
// get data
const getapi = async function (list) {
try {
- let arr = list.map((v) => {
- let found = apis.find((api) => api.name === v.name);
- let url = (v.path ? paths.find((x) => x.name === v.path).url : path) + (v.url ? v.url : found.url);
+ const arr = list.map((v) => {
+ const found = apis.find((api) => api.name === v.name);
+ const url = (v.path ? paths.find((x) => x.name === v.path).url : path) + (v.url ? v.url : found.url);
let params = v.params ? v.params : found.params === undefined ? {} : found.params;
params.login = $store.login ? $store.login.id : undefined;
return { url, params };
@@ -1365,21 +1365,21 @@ export default defineNuxtPlugin((nuxtApp) => {
return copy;
};
- const getdata = async function (name, filter, params, first) {
- let found = findapi(name);
+ const getdata = async function (name, { filter, params, first = false } = {}) {
+ const found = findapi(name);
if (params) found.params = params;
else if (filter) found.params.filter = filter;
- let rs = await getapi([found]);
- let data = rs[0].data;
+ const rs = await getapi([found]);
+ const { data } = rs[0];
if (data) {
if (data.rows) {
- return first ? (data.rows.length > 0 ? data.rows[0] : undefined) : data.rows;
+ return first ? data.rows[0] : data.rows;
} else {
- let rows = Array.isArray(data) ? data : [data];
+ const rows = Array.isArray(data) ? data : [data];
return first ? (rows.length > 0 ? rows[0] : data) : data;
}
} else {
- let rows = Array.isArray(data) ? data : [data];
+ const rows = Array.isArray(data) ? data : [data];
return first ? (rows.length > 0 ? rows[0] : data) : data;
}
};
diff --git a/app/plugins/04-components.js b/app/plugins/04-components.js
index 02de6f6..d8e93a2 100644
--- a/app/plugins/04-components.js
+++ b/app/plugins/04-components.js
@@ -87,12 +87,12 @@ import MenuAccount from "@/components/menu/MenuAccount.vue";
import ImageLayout from "@/components/media/ImageLayout.vue";
import CountdownTimer from "@/components/common/CountdownTimer.vue";
-import CustomerInfo2 from "@/components/customer/CustomerInfo2.vue";
+import CustomerInfo from "@/components/customer/CustomerInfo.vue";
import MenuFile from "@/components/menu/MenuFile.vue";
const components = {
PivotDataView,
- CustomerInfo2,
+ CustomerInfo,
CountdownTimer,
InternalEntry,
ViewList,