Refactoring code module 01_metadata => 01_personal
This commit is contained in:
parent
d41a2516c3
commit
6c72c90524
42 changed files with 629 additions and 7824 deletions
|
|
@ -1,18 +1,23 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import type {
|
||||
DataResponse,
|
||||
DataRow,
|
||||
} from "../interface/response/personal/personal";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const { date2Thai } = useCounterMixin();
|
||||
|
||||
export const usePersonalDataStore = defineStore("PersonalData", () => {
|
||||
const row = ref<DataRow[]>([]);
|
||||
const currentTab = ref<string>("list_prefix");
|
||||
const row = ref<DataRow[]>([]); // ข้อมูลในตาราง
|
||||
const currentTab = ref<string>("list_prefix"); // Tab ปัจจุบัน
|
||||
|
||||
function save(data: DataResponse[]) {
|
||||
/**
|
||||
* บันทึกข้อมูลลงใน row.value
|
||||
* @param data ข้อมูลรายการจาก API
|
||||
*/
|
||||
async function save(data: DataResponse[]) {
|
||||
const list = data.map((e) => ({
|
||||
...e,
|
||||
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
||||
|
|
@ -20,9 +25,10 @@ export const usePersonalDataStore = defineStore("PersonalData", () => {
|
|||
}));
|
||||
row.value = list;
|
||||
}
|
||||
|
||||
return {
|
||||
save,
|
||||
row,
|
||||
currentTab
|
||||
currentTab,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue