feat: add flow store

This commit is contained in:
Methapon2001 2024-06-25 16:05:42 +07:00
parent 02c5aa2a1c
commit 44ae39907e
7 changed files with 83 additions and 55 deletions

View file

@ -11,8 +11,10 @@ import {
} from './types';
import { CustomerBranch } from '../customer/types';
import axios from 'axios';
import useFlowStore from '../flow';
const useEmployeeStore = defineStore('api-employee', () => {
const flowStore = useFlowStore();
const data = ref<Pagination<Employee[]>>();
const globalOption = ref();
const ownerOption = ref<CustomerBranch[]>();
@ -48,7 +50,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
{
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
},
@ -75,7 +77,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
>('/employee', payload, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
});
@ -108,7 +110,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
>(`/employee/${id}`, payload, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
});
@ -137,7 +139,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
const res = await api.delete<Employee>(`/employee/${id}`, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
});
@ -159,7 +161,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
const res = await api.get<EmployeeCheckup[]>(`/employee/${id}/checkup`, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
});
@ -179,7 +181,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
const res = await api.get<EmployeeWork[]>(`/employee/${id}/work`, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
});
@ -199,7 +201,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
const res = await api.get<EmployeeOther>(`/employee/${id}/other-info`, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
});
@ -221,7 +223,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
{
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
},
@ -244,7 +246,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
{
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,
'X-Tid': flow?.transactionId,
},
},