pukaad-ui-lib 1.319.0 → 1.320.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
<script setup>
|
|
151
151
|
import { computed, onMounted, watch, reactive, ref } from "vue";
|
|
152
152
|
import { useNuxtApp } from "nuxt/app";
|
|
153
|
+
import { useDebounceFn } from "@vueuse/core";
|
|
153
154
|
import { useApi } from "#pukaad-ui/runtime/composables/useApi";
|
|
154
155
|
import SuggestPlaceMap from "./suggest-place-map.vue";
|
|
155
156
|
import InputLocalizedName from "../../input/input-localized-name.vue";
|
|
@@ -228,7 +229,6 @@ const fetchApprovedPlaces = async (page, pageSize, search) => {
|
|
|
228
229
|
};
|
|
229
230
|
};
|
|
230
231
|
const lastCheckedDuplicateName = ref("");
|
|
231
|
-
let duplicateCheckTimer = null;
|
|
232
232
|
const showDuplicateAlert = async (item) => {
|
|
233
233
|
const result = await $alert.show({
|
|
234
234
|
type: "warning",
|
|
@@ -273,12 +273,12 @@ const checkDuplicate = async () => {
|
|
|
273
273
|
} catch {
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
|
+
const debouncedCheckDuplicate = useDebounceFn(checkDuplicate, 600);
|
|
276
277
|
watch(
|
|
277
278
|
() => [modelValue.businessName, modelValue.address?.tambon_id],
|
|
278
279
|
([name]) => {
|
|
279
280
|
if (!name || !isAddressCompleted.value || props.state === "backoffice") return;
|
|
280
|
-
|
|
281
|
-
duplicateCheckTimer = setTimeout(checkDuplicate, 600);
|
|
281
|
+
debouncedCheckDuplicate();
|
|
282
282
|
}
|
|
283
283
|
);
|
|
284
284
|
const categoryOptions = ref([]);
|