ขออัปเดตข้อมูลจากกรมการปกครอง
This commit is contained in:
parent
189347832c
commit
c49d222a3f
10 changed files with 2155 additions and 14 deletions
|
|
@ -2,7 +2,7 @@ import { ref } from "vue";
|
|||
import { defineStore } from "pinia";
|
||||
import { useCounterMixin } from "./mixin";
|
||||
|
||||
const { messageError, success } = useCounterMixin();
|
||||
const { messageError, success,hideLoader } = useCounterMixin();
|
||||
|
||||
export const useLinkageStore = defineStore("linkageData", () => {
|
||||
const apiURL = ref<string>("http://127.0.0.1:51548"); // API URL From Agent
|
||||
|
|
@ -248,21 +248,21 @@ export const useLinkageStore = defineStore("linkageData", () => {
|
|||
message = `${code}${T}${officeCode.value}${versionCode.value}${serviceCode}${idcard}`;
|
||||
}
|
||||
|
||||
fetch(`${apiURL.value}/ami/request`, {
|
||||
await fetch(`${apiURL.value}/ami/request`, {
|
||||
method: "POST",
|
||||
headers: { "Content-type": "application/json; charset=UTF-8" },
|
||||
body: JSON.stringify({
|
||||
message: message,
|
||||
}),
|
||||
})
|
||||
.then((response) => {
|
||||
.then(async (response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw new Error("Something went wrong");
|
||||
})
|
||||
.then(async (data) => {
|
||||
const convertData = await bin2String(data);
|
||||
const convertData = bin2String(await data);
|
||||
let removeText = await convertData.substr(9); // ตัด CODEREQ[4] + Status[5]
|
||||
|
||||
if (code === 9080) {
|
||||
|
|
@ -277,6 +277,7 @@ export const useLinkageStore = defineStore("linkageData", () => {
|
|||
})
|
||||
.catch(async (error) => {
|
||||
messageError(q, error);
|
||||
hideLoader()
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue