This commit is contained in:
Warunee Tamkoo 2024-12-23 15:25:28 +07:00
parent 2fc2a3faf0
commit 79453457d1

View file

@ -18,8 +18,8 @@ export const useLinkageStore = defineStore("linkageData", () => {
/** API /** API
* @param {any} q this quasar * @param {any} q this quasar
*/ */
function fetchDeviceLists(q: any) { async function fetchDeviceLists(q: any) {
fetch(`${apiURL.value}/smart-card/device`, { await fetch(`${apiURL.value}/smart-card/device`, {
method: "GET", method: "GET",
}) })
.then((response) => { .then((response) => {
@ -41,10 +41,13 @@ export const useLinkageStore = defineStore("linkageData", () => {
/** connect device /** connect device
* @param {any} q this quasar * @param {any} q this quasar
*/ */
function readDevice(q: any) { async function readDevice(q: any) {
fetch(`${apiURL.value}/smart-card/connect/?deviceName=${devices.value}`, { await fetch(
method: "GET", `${apiURL.value}/smart-card/connect/?deviceName=${devices.value}`,
}) {
method: "GET",
}
)
.then((response) => { .then((response) => {
if (response.ok) { if (response.ok) {
return response.json(); return response.json();
@ -63,7 +66,7 @@ export const useLinkageStore = defineStore("linkageData", () => {
* @param {any} q this quasar * @param {any} q this quasar
*/ */
async function getInfo(q: any) { async function getInfo(q: any) {
fetch(`${apiURL.value}/smart-card/info`, { await fetch(`${apiURL.value}/smart-card/info`, {
method: "GET", method: "GET",
}) })
.then(function (response) { .then(function (response) {
@ -86,7 +89,7 @@ export const useLinkageStore = defineStore("linkageData", () => {
* @param {any} q this quasar * @param {any} q this quasar
*/ */
async function postReadIdCard(q: any) { async function postReadIdCard(q: any) {
fetch(`${apiURL.value}/smart-card/read/`, { await fetch(`${apiURL.value}/smart-card/read/`, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
fields: [ fields: [
@ -122,8 +125,8 @@ export const useLinkageStore = defineStore("linkageData", () => {
/** setting ami environment /** setting ami environment
* @param {any} q this quasar * @param {any} q this quasar
*/ */
function amiEnvironment(q: any) { async function amiEnvironment(q: any) {
fetch(`${apiURL.value}/ami/environment`, { await fetch(`${apiURL.value}/ami/environment`, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
host: "lkbmabk.bma.go.th", host: "lkbmabk.bma.go.th",
@ -152,8 +155,8 @@ export const useLinkageStore = defineStore("linkageData", () => {
* connect ami * connect ami
* @param q this quasar * @param q this quasar
*/ */
function amiConnect(q: any) { async function amiConnect(q: any) {
fetch(`${apiURL.value}/ami/connect`, { await fetch(`${apiURL.value}/ami/connect`, {
method: "GET", method: "GET",
}) })
.then((response) => { .then((response) => {
@ -175,8 +178,8 @@ export const useLinkageStore = defineStore("linkageData", () => {
* card authentication * card authentication
* @param q this quasar * @param q this quasar
*/ */
function authentication(q: any) { async function authentication(q: any) {
fetch(`${apiURL.value}/smart-card/authentication`, { await fetch(`${apiURL.value}/smart-card/authentication`, {
method: "GET", method: "GET",
}) })
.then((response) => { .then((response) => {
@ -211,7 +214,7 @@ export const useLinkageStore = defineStore("linkageData", () => {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}; };
fetch(`${apiURL.value}/smart-card/verify`, requestOptions) await fetch(`${apiURL.value}/smart-card/verify`, requestOptions)
.then((response) => { .then((response) => {
if (response.ok) { if (response.ok) {
return response.json(); return response.json();
@ -290,8 +293,8 @@ export const useLinkageStore = defineStore("linkageData", () => {
}); });
} }
function disconnect(q: any) { async function disconnect(q: any) {
fetch(`${apiURL.value}/smart-card/disconnect`, { await fetch(`${apiURL.value}/smart-card/disconnect`, {
method: "GET", method: "GET",
}) })
.then((response) => { .then((response) => {