refactor: add submitWorkHistory and submitHealthCheck

This commit is contained in:
Net 2024-08-07 18:34:50 +07:00
parent 5e525e43da
commit 7a81991c79
4 changed files with 170 additions and 15 deletions

View file

@ -82,7 +82,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
transactionId?: string;
},
) {
const { code, image, ...payload } = data;
const { id, code, image, ...payload } = data;
const res = await api.post<
Employee & { profileImageUrl: string; profileImageUploadUrl: string }
>('/employee', payload, {
@ -196,9 +196,9 @@ const useEmployeeStore = defineStore('api-employee', () => {
transactionId?: string;
},
) {
const { ...payload } = data;
const { id, statusSave, ...payload } = data;
const res = await api.put<EmployeeCheckupCreate>(
`/employee/${employeeId}/checkup}`,
`/employee/${employeeId}/checkup/${id}`,
{ ...payload },
{
headers: {
@ -269,7 +269,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
}
async function editById(
id: string,
employeeId: string,
data: Partial<EmployeeCreate>,
flow?: {
sessionId?: string;
@ -277,10 +277,10 @@ const useEmployeeStore = defineStore('api-employee', () => {
transactionId?: string;
},
) {
const { code, image, ...payload } = data;
const { id, code, image, ...payload } = data;
const res = await api.put<
Employee & { imageUrl: string; profileImageUploadUrl: string }
>(`/employee/${id}`, payload, {
>(`/employee/${employeeId}`, payload, {
headers: {
'X-Session-Id': flow?.sessionId,
'X-Rtid': flow?.refTransactionId || flowStore.rtid,

View file

@ -57,6 +57,7 @@ export type Employee = {
};
export type EmployeeCreate = {
id?: string;
code: string;
image: File | null;
customerBranchId: string;