文件
hyb-oa/client/src/api/userSensitive.ts
T

29 行
931 B
TypeScript

import { apiRequestData } from "./http";
export type EmployeeBankSummary = {
bankInstitution: { id: string; code: string; name: string } | null;
bankName: string | null;
bankAccountMasked: string | null;
};
export async function fetchUserSensitive(userId: string) {
return apiRequestData<EmployeeBankSummary & { idNumber?: string | null }>(`/api/users/${userId}/sensitive`);
}
export async function updateUserBank(userId: string, payload: {
bankInstitutionId: string | null;
bankAccount?: string | null;
}) {
return apiRequestData<{ id: string; updatedFields: string[] }>(`/api/users/${userId}/sensitive`, {
method: "PATCH",
body: JSON.stringify(payload),
});
}
export async function revealUserBank(userId: string, reason: string) {
return apiRequestData<{ bankAccount: string | null }>(`/api/users/${userId}/sensitive/bank/reveal`, {
method: "POST",
body: JSON.stringify({ reason }),
});
}