This commit is contained in:
Viet An
2026-05-21 09:45:01 +07:00
parent a52c33706a
commit 8f95fee8a7
18 changed files with 70 additions and 45 deletions

View File

@@ -1197,18 +1197,18 @@ export default defineNuxtPlugin((nuxtApp) => {
const found = findapi(name);
const curpath = found.path ? paths.find((x) => x.name === found.path).url : path;
let rs;
if (!Array.isArray(data)) {
rs = await $fetch(`${curpath}${found.url}`, {
method: "POST",
body: data,
params: { values },
});
} else {
if (Array.isArray(data)) {
rs = await $fetch(`${curpath}import-data/${found.url.substring(5, found.url.length - 1)}/`, {
method: "POST",
body: data,
params: { values, action: "import" },
});
} else {
rs = await $fetch(`${curpath}${found.url}`, {
method: "POST",
body: data,
params: { values },
});
}
// update store
if (found.commit) {